Web开发中combobox怎么动态添加数据呀?

各位高手,我想单机一个按钮来动态给一个combobox添加数据,请问如何做到?
---------------------------------------------------------------

 1<html><head>
 2<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 3<meta content="MSHTML 6.00.2600.0" name="GENERATOR"/><script id="clientEventHandlersJS" language="javascript">   
 4<!--   
 5  
 6function button1_onclick() {   
 7var text = document.all.text1.value;   
 8var value = document.all.text2.value;   
 9var option = new Option(text,value);   
10document.all.select1.options[document.all.select1.options.length] = option;   
11  
12  
13}   
14  
15//-->   
16</script>
17</head>
18<body>
19<p><select id="select1" name="select1" size="1"> </select></p>
20<p>Show:<input id="text1" name="text1"/></p>
21<p>Value:<input id="text2" name="text2"/></p>
22<p><input id="button1" language="javascript" name="button1" onclick="return button1_onclick()" type="button" value="Button"/></p></body></html>

---------------------------------------------------------------

将上面的函数改为如下格式即可在VBSCRIPT中运行
function button1_onclick()
set voption = document.createElement("option")
voption.value="value"
voption.text ="text"
select1.options.add voption
end function

Published At
Categories with Web编程
comments powered by Disqus