动态增加一个下拉选项,如何把其改为默认(selected)? Option.selected=true ;Input.add(Option); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 or:Input.options[Input.options.length] = new Option("","",true,true) Option.selected=true ;Input.add(Option);这个不行! Input.options[Input.options.length] = new Option("","",true,true)也不行!还是没增加默认空值! 你试没有试啊就说不行????<script>window.onload = function(){ Input = document.getElementById("s") Input.options[Input.options.length] = new Option("","",true,true)}</script><body><select id=s><option>aaa</select></body> 你的代码是可以,但是我的情况是有点不同,我是动态在表格种增加一行,动态在在某列增加一个下拉框的。row = eval("document.all[" + '"' + id + '"' + "]").insertRow();selectCell = row.insertCell();xxxCell = row.insertCell();var Option = document.createElement("option");Option.text='';Option.value='' ;Option.selected=true ;Input.add(Option);selectCell.appendChild(Input);我是这样增加的,用你给的方法,不行。 請教幾個 javascript 事件監控及字符提取問題 正则表达式问题 xmlhttp 乱码了 咋办 storyline作出的scorm2004课件,如何去控制课件内学习的时间 banner焦点图问题 谁懂Dreamweaver插件开包,进来看看!!! 如何设定邮件的主题 求助 打开窗口 seajs和requirejs如何自学啊,在网上看了好多资料,感觉还是摸 不着门路,不会使用啊,肯求大神指点啊,跪谢!!! jstree读取到后台数据json字符串后,怎么显示到前台? 请问如何实现模拟点击? [原创]仿NOKIA手机里面的接水管游戏(javascript)
Input.add(Option);
这个不行!
也不行!还是没增加默认空值!
<script>
window.onload = function()
{
Input = document.getElementById("s")
Input.options[Input.options.length] = new Option("","",true,true)
}
</script>
<body>
<select id=s><option>aaa</select>
</body>
row = eval("document.all[" + '"' + id + '"' + "]").insertRow();
selectCell = row.insertCell();
xxxCell = row.insertCell();var Option = document.createElement("option");
Option.text='';
Option.value='' ;
Option.selected=true ;
Input.add(Option);
selectCell.appendChild(Input);
我是这样增加的,用你给的方法,不行。