Click to See Complete Forum and Search --> : for next vbscript


vbnov
January 10th, 2003, 05:32 PM
hi
i want to display 10 numbers in a list box using for next .... (i.e) if "i" is the control variable I want the value of "i" to be displayed in the list box.Can somebody help me. thnx.

hspc
January 12th, 2003, 04:38 PM
Hi :
this code is a HTML page with a button and listbox
click the button and the list will be populated..


<html>
<head>

<script language="vbscript">

dim bln
bln=0

function putnum()
dim opt
dim i

'check if list is populated
if bln = 1 then
exit function
end if

bln=1

for i=1 to 10
set opt=document.createElement("option")
opt.text=i
opt.value=i
lst.add opt
next

end function
</script>
</head>
<body>
&nbsp;
<input type=button value="Populate" onclick="putnum">
<SELECT id="lst" size="5" name="lst">
</SELECT>
</body>
</html>