其中可以知道value的属性,有人说bbb是 text属性?或label属性,都不行,急死了
解决方案 »
- 用js在map上 实现 不规则描点,记录在map里的坐标
- 新手又求助了。
- jquery 1.4.2 查找 table 下所有tr 下的第3个TD内容 帮帮忙
- 哪位高手帮我解密一下这代码
- 求助,急,在线等!!!
- 请问这段代码有什么问题,为什么总是实现不了呢,谢谢各位了!
- 求教,如下网页代码使用后为啥不能后退?
- 为什么elements提示对象为空?
- 为什么textarea里的数据提交到另一个页面后,接收不到里面的回车换行符呀,如何解决???
- windows的api函数可以查MSDN,那么JavaScript的对象和方法可以在哪里查呢?
- 请教不用form表单,如何传递checkbox的值
- 梅大侠请进,MzTreeView2问题
<option value=c>aaa</option>
<option value=c1>aaa1</option>
</select>
new Option(text, value, defaultSelected, selected)
<body>
<form id=form1>
<script>
function creopt(){
var obj,obj1;
obj=document.all.sel;
obj[obj.length]=new Option("bbbb", "vv", false, false);
}
</script>
<select id=sel name=sel>
<option id=aaa value=aaa>aaa</option>
</select>
<input type=button value="create" onclick="javascript:creopt();">
<input type=button value="check" onclick="alert(document.all.sel.value);">
</form>
</body>
</html>
Inherits from/OverridesInherits from HTMLElement
Synopsis
select.options[i]ConstructorIn JavaScript 1.1, Option objects can be dynamically created with the Option( ) constructor, as follows:
new Option(text, value, defaultSelected, selected)Arguments
textAn optional string argument that specifies the text property of the Option object.
valueAn optional string argument that specifies the value property of the Option object.
defaultSelectedAn optional boolean argument that specifies the defaultSelected property of the Option object.
selectedAn optional boolean argument that specifies the selected property of the Option object.