Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop down auto on numbers 1

Status
Not open for further replies.

evergrean100

Technical User
Joined
Dec 1, 2006
Messages
115
Location
US
I need to make a loop to list 100 number in my drop down:

Code:
<select name="myname">
<option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
...

Please advise how I can do that?
I know how to do a for loop:
for(i=0;i<=100;i++)
{
document.write(i);
}

but not sure how to get that value in my drop down??
 
[tt]<select name="myname">
<script language="javascript">
for (var i=1; i<101;i++) {
document.write ("<option value='"+i+"'>"+i+"</option>")
}
</script>
</select>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top