I'm not sure if there is something wrong with my while loop or the innerHTML section of my code but I'm not able to show the drop down lists in the div tags when the submit button is clicked. Can anyone see whats wrong with it.
<html>
<head>
<script type="text/javascript">
function getvalue() {
number = document.getnumber.input.value;
document.getElementById("result").value = number;
}
</script>
</head>
<body>
<script>
function generatedropdown() {
html = '<select name="select" id="i">';
while (i < number) {
html+='<option>Test 1</option>';
html+='<option>Test 2</option>';
html+='<option>Test 3</option>';
html+='<option>Test 4</option>';
html+='<option>Test 5</option>';
i++;
}
html+='</select>';
document.getElementById("my-output").innerHTML = html;
}
</script>
<form name="getnumber">
Input number: <input type="text" name="input">
<input type="button" value="Next" onClick="getvalue()">
</form>
<form id="showlists">
Number entered: <input type="text" id="result" readonly="readonly">
<input type="button" value="Show lists" onClick="generatedropdown()">
<div id="my-output">Generated List:</div>
</form>
</body>
</html>