其中可以知道value的属性,有人说bbb是 text属性?或label属性,都不行,急死了
解决方案 »
- 为什么只能求当前日期的上1天(相减),而不能求下1天(用加法就出错)???
- mailto的Body如何傳圖片
- 比较菜的问题 JS 图片预览
- 求FF中类似 createPopup函数的功能
- 用JQ怎么判断版本号是否重复,要和数据库的对比
- 有人对javascript的解析比较熟吗?
- 在JS里面我要把“abcd” 替换成 “1234” 怎么替换呀
- JS调用alert前后改变值改变???
- js:代参函数A作为参数传递时,A参数怎么办
- 如何将Javascript中的变量 a 替换为<body background=a>?
- 请教不用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.