如何动态添加<option>选项 http://www.csdn.net/Expert/topicview.asp?id=797931 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var input_node = document.createElement("<input type=radio>") IE和NS通用的方法:<form name=f><select name=s></selct><input type=button onclick="a()" value=add></form><script>var i=0function a(){b=document.f.svar opt=new Option("text"+ i,"value"+i,true,true)b.options[b.options.length] = opti++}</script> <select id=demo></select><script>var option_node = document.createElement("OPTION")option_node.innerText="hehe"demo.appendChild(option_node)</script> <script>var _obj=document.all("test");var _o=document.createElement("Option");_o.text="text";_o.value="1";_obj.add(_o);</script> 用javascript实现,the_select为操作的select框,the_array为一个数组,用来赋值,其实不用也可以。function setOptionText(the_select, the_array){the_select.options.length = the_array.length-1;for (loop=0; loop < the_array.length-1; loop++) { the_select.options[loop].text = the_array[loop]; the_select.options[loop].value = the_array[loop]; }} setTimeout的使用疑问 请问delete与置空的区别 网页显示的问题 js控制网页播放器的问题? javascript页面跳转的went 请问如何判断,JS中的对象是否存在 如何实现 下载软件,先输入密码确定后,才可以下载 如何只用客户端技术在点击不同链接后,在当前同一页面的相同位置装入并显示,不同的JS文件内容? 晓风残月,进来下,继续我的问题啊!!! 响应键盘事件的又一问题 如何用正则表达式判断一个ip 怎么样的到没有在样式表里面设定的值.
<form name=f>
<select name=s></selct>
<input type=button onclick="a()" value=add>
</form>
<script>
var i=0
function a()
{
b=document.f.s
var opt=new Option("text"+ i,"value"+i,true,true)
b.options[b.options.length] = opt
i++
}
</script>
<script>
var option_node = document.createElement("OPTION")
option_node.innerText="hehe"
demo.appendChild(option_node)
</script>
var _obj=document.all("test");
var _o=document.createElement("Option");
_o.text="text";
_o.value="1";
_obj.add(_o);
</script>
{
the_select.options.length = the_array.length-1;
for (loop=0; loop < the_array.length-1; loop++)
{
the_select.options[loop].text = the_array[loop];
the_select.options[loop].value = the_array[loop];
}
}