刚刚碰到一个要为html select添加readonly属性的要求,可是select是不支持readonly属性的,找了找,方法还是有的,不过大都比较麻烦。以下的方法个人认为是最简单的: <select id="lstTest" onfocus="this.defaultIndex=this.selectedIndex;" onchange="this.selectedIndex=this.defaultIndex;"> <option value="1">test1<...
简直逆天 html select支持readonly属性 <selectid="lstTest"onfocus="this.defaultIndex=this.selectedIndex;"onchange="this.selectedIndex=this.defaultIndex;"> <option value="1">test1</option> <option value="2">test2</option> <option value="3"selected="selected">test3</option> <option value="4">...
1、在html中使用以下代码,在select外层加1个span,通过js控制。这种设置的不足之处是IE浏览器兼容,fireFox及其他不兼容..<spanonmousemove="this.setCapture();"onmouseout="this.releaseCapture();"onfocus="this.blur();"><selectid="select1"><optionvalue="0">0</option><optionvalue="1">1</option><...
只读复选框的标记使用<input>元素,并设置readonly属性为"readonly"。 select(下拉列表)是一种允许用户从预定义的选项中选择一个选项的表单元素。它通常用于提供一组选项供用户选择。select的标记使用<select>元素,并在其中使用<option>元素定义选项。 禁用select(Disabled Select)是指在特定情况下,将下拉列表设置为不...
让html select支持readonly属性 刚刚碰到一个要为html select添加readonly属性的要求,可是select是不支持readonly属性的,找了找,方法还是有的,不过大都比较麻烦。以下的方法个人认为是最简单的: <select id="lstTest" onfocus="this.defaultIndex=this.selectedIndex;" onchange="this.selectedIndex=this.defaultIndex;"...
multiple:用于 <input> 和<select>,指示是否可以选择多个值。 checked:用于 <input type="checkbox"> 或<input type="radio">,表示控件是否被选中。 selected:用于 <option> 标签,表示是否选中该选项。 autofocus:用于 <input>, <textarea>,和 <select>,页面加载时自动获得焦点。 readonly:使表单控件为只读状态...
<option value="1">1</option> </select> </span> 2、使用js文件,这种方法的不足之处和第一种一样。 <select name="select"> <option>aaa</option> </select> <script type="text/javascript"> SetReadOnly(document.getElementById("select")); ...
HTML中Select不用Disabled实现ReadOnly的效果 方法如下: 代码如下:<select onbeforeactivate=”return false” onfocus=”this.blur()” onmouseover=”this.setCapture()” onmouseout=”this.releaseCapture()”> <option>1 </select> select-disabled-传值 这种场景通常可以通过设置`select...
option -- 默认单选 <selectname="" id=""><optionvalue="城市">湖边的角逐</option><optionvalue="城市">阿拉曼机场</option><optionvalue="城市">烈焰丘陵</option></select> multiple -- 下拉框式选择多选模式,多选需要shift按下 selected -- 默认选项 ...
<select name=”下拉框名”> <option selected=”selected” (那个是初始选择就添加) value=”提交值”>列表1</option> <option>列表2</option> </select> (<optgrounp label=”分组名称”><option></option></optgrounp>用来做有子项的下拉框) ...