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 9288827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:00:10+00:00 2026-06-18T20:00:10+00:00

Hello javascript experts, I’ve been stuck on this code for few days with no

  • 0

Hello javascript experts, I’ve been stuck on this code for few days with no idea how to fix it. I have a textfield where user can put in a value. When the value is submitted a number of dropdown lists will be generated by the inputted value. However I’m not too sure what went wrong with the code but it seems there is no response after you submit the value.

Following is my current code:

Javascript:

 <script type="text/javascript">

function getvalue() {
 var number = document.getnumber.input.value;
 document.getElementById('result').value = number; 
}

function generatedropdown() {
 while (i < number)
 {
     document.write
     (
     <select name="list">
     <option>1</option>
     <option>2</option>
     </select>
     );
     i++;
 }
  }

 </script>

HTML:

 <form name="getnumber">
Input number: <input type="text" name="input">
<input type="button" value="Next" onclick="getvalue()">
  </form> 

<form name="showdropdown">
Number entered: <input type="text" id="result" readonly="readonly">
<input type="button" value="Show lists" onclick="generatedropdown()">   
</form>

EDIT:
Sorry I’m a bit noobie at Javascript. I have moved function generatedropdown() to the body tags and now I get some feedback after submitting. However I’m still abit confuse in turning the string into a statement.

  • 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-06-18T20:00:12+00:00Added an answer on June 18, 2026 at 8:00 pm

    document.write takes a string…meaning you have to put that statement in quotes…and escape your other quotes (i.e. \”) or change them to single quotes…but this isn’t going to work either because the body is already written – you need to add it to the body object…consider using innerHTML…or document.body.createElement

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

Sidebar

Related Questions

Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
hello i am using this Page.ClientScript.RegisterStartupScript() to call a javascript function from vb code
Hello I have a php code which by echo calls the javascript function expand(txt)
I have this simple hello world version of a google map api javascript v3
I tried running this JavaScript code in the address bar in Firefox 6: javascript:alert(Hello)
Hello I have some javascript code, a script included inside my page. I want
Hello I have the following code: Javascript/jQuery: $(document).ready(function() { $(.clickMe).click(function() { $(.textBox).toggle(); }); });
Hello how would I create this in Javascript?: You have <strong><span id=commentsCounter>${const['COMMENT_MAX_LENGTH']}</span></strong> characters left.<br/>
Let's say I have some simple Javascript like: <script> var hello = function(){ alert(Hello
I always loved how i can quickly do with JavaScript: function hello(){ return ['foo',

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.