Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6959365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:15:45+00:00 2026-05-27T15:15:45+00:00

I have this basic auto complete JavaScript that works well, but you need to

  • 0

I have this basic auto complete JavaScript that works well, but you need to hard code the web page. What I’m trying to do is send the “Autocomplete” variable data to the page using a Perl script

The working JavaScript code looks like this:

var CustomArray = new Array('an apple','alligator','elephant','pear','kingbird',
                          'kingbolt','kingcraft','kingcup','kingdom','kingfisher',
                          'kingpin','SML');

Now the new code is:

var CustomArray=new Array(Autocomplete);

And the Perl script is sending back the data to the browser looking like this:

var Autocomplete = 'an apple','alligator','elephant','pear','kingbird',
'kingbolt','kingcraft','kingcup','kingdom','kingfish er','kingpin','SML'

I also tried

var Autocomplete = ['an apple','alligator','elephant','pear','kingbird',
                    'kingbolt','kingcraft','kingcup','kingdom','kingfisher',
                    'kingpin','SML']

But I get: 'an apple','alligator','elephant','pear','kingbird','kingbolt','kingcraft','kingcup','kingdom','kingfish er','kingpin','SML' All as one string in the auto complete.

I cant seem to get it to work right. Full HTML code is below.

<html>
<head>
<script language="javascript" type="text/javascript" src="http://www.comicinvasion.com/Code/Java/Autocomplete/Autocomplete.js"></script>
<script language="javascript" type="text/javascript" src="http://www.comicinvasion.com/Code/Java/Autocomplete/Common.js"></script>
<script language="JavaScript1.2" type="text/javascript" src="http://www.ComicInvasion.com/cgi-bin/Autocomplete.pl"></script>


<script>
var CustomArray=new Array(Autocomplete);
</script>

</head>

<body>

<input type='text' style='font-family:verdana;width:300px;font-size:12px' id='ACMP' value=''/>

<script>
var obj = actb(document.getElementById('ACOMP'),CustomArray);
</script>

</body>
</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:15:45+00:00Added an answer on May 27, 2026 at 3:15 pm

    First, it looks like there is a typo. The id of your input element is ACMP whereas you pass 'ACOMP' to getElementById.

    Second, you do not provide the source code for your Perl script. It might look like this:

    #!/usr/bin/perl
    
    use utf8;
    use strict; use warnings;
    use CGI();
    
    local $| = 1;
    
    print CGI::header(
        -type => 'text/javascript',
        -charset => 'utf-8',
    );
    
    print <<JS;
    var Autocomplete = [
        'an apple','alligator','elephant','pear','kingbird',
        'kingbolt','kingcraft','kingcup','kingdom','kingfisher',
        'kingpin','SML'
    ];
    JS
    

    With the following HTML, autocompletion works:

    <!DOCTYPE html>
    <html>
    <head>
    
    <script type="text/javascript"
    src="http://www.comicinvasion.com/Code/Java/Autocomplete/Autocomplete.js"></script>
    
    <script type="text/javascript" src="http://www.comicinvasion.com/Code/Java/Autocomplete/Common.js"></script>
    
    <!-- Replace with the URI of your script -->
    <script type="text/javascript" src="http://test:8080/cgi-bin/autocomplete.pl"></script>
    
    </head>
    
    <body>
    
    <input type='text'
    style='font-family:verdana;width:300px;font-size:12px'
    id='ACOMP' value=''>
    
    <script type="text/javascript">
    var obj = actb(document.getElementById('ACOMP'), Autocomplete);
    </script>
    
    </body>
    </html> 
    

    Finally, I find it curious that your JavaScript files live in a directory called Java.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a really basic question but... I have some code like this var
I realize this is a basic question but I have searched online, been to
So this seems pretty basic but I can't get it to work. I have
I'm a noob so this is probably basic stuff, but I have tried to
I have some basic idea on how to do this task, but I'm not
I have a basic website nav layout that looks like this: <li class=folder parent_folder>
I have created a basic WCF service in IIS. I am aware that this
This is probably a basic html/css question... I have a simple one-button form that
Sorry if this is generic in nature, but I have a question that maybe
this may well be a very basic question, but I haven't been able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.