如何让select下拉选择只读 呵呵,楼主的本意不是这样的吧。他好像是说点击选择之后select显示的内容不变,就是说不管你选择哪个值,最后的值都是原始选择的哪个,不知道队不?我也有同样一个问题,大家帮忙啊! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不知为什么要这样,不可以用在修改了值之后再用javascript将值改回来不就可以了吗? <select onchange="selectedIndex=1"><option>abc<option selected>def<option>ghi</select> <select onchange="this.selectedIndex=1"><option>1</option><option selected>2</option><option>3</option></select> 法1:<select onchange="this.selectedIndex=1"><option>1</option><option selected>2</option><option>3</option></select>法2:<style>select{falcon:expression(selectedIndex=0)}</style><select><option>1</option><option>2</option></select><select ><option>1</option><option>2</option></select>法3:<style>select.s1{falcon:expression(selectedIndex=0)}</style><select class="s1"><option>1</option><option>2</option></select><select ><option>1</option><option>2</option></select> IE 6:<select onbeforeactivate="return false"><option>a<option selected>b<option>c</select> 给你一个经典站点,里面的ComboBox应该符合你的要求,解决了问题给分给我http://webfx.eae.net 推荐freefalcon(心宇) 的方法二和方法三,不推荐方法一。因为,在浏览器的Address栏中键入javascript:alert(document.getElementsByTagName("select")[0].selectedIndex=0);会使方法一失效。当然,也能使用相同的方法(键入其它命令)使方法二和方法三失效。我的笨方法是定时设置:<form name=thisform> <select name=sel> <option>1</option> <option>2</option> </select></form><script>setInterval("thisform.sel.selectedIndex=1", 100);</script> <select onmouseover="this.setCapture()" onmouseout="this.releaseCapture()"><option>1</option><option selected>2</option><option>3</option></select>OR<select onchange="selectedIndex=this.defaultChecked"><option>1</option><option>2</option><option>3</option></select> 加一个<select onfocus="this.blur()" onmouseover="this.setCapture()" onmouseout="this.releaseCapture()"> 对checkbox还好办:<input type=checkbox onfocus="this.blur()" onclick="checked=defaultChecked">对radio呢:<input type=radio name="test" onclick="event.returnValue=false" checked><input type=radio name="test" onclick="event.returnValue=false">还没想到什么简单直捷的方法。对只要view的页面我是干脆不写name来实现readonly的,要是需要submit的页面我想就只好用脚本来维护选中状态了。 呵呵说明一下,<input type=radio name="test" onclick="event.returnValue=false" checked>中的onclick部分是错的。我还没想出对的写法。 试过了没用。好像只有不写name最有用。 嗯,需要submit的页面也可以不写name,用该name定义一个hidden来保存选中项的value就是了呵呵,又可以偷懒不写脚本了 :-P 象这样。把:<form ...><input type=radio name=emu value=1>item1<BR><input type=radio name=emu value=2 checked>item2<BR><input type=radio name=emu value=3>item3<BR></form>改为:<form ...><input name=emu value=2 type=hidden><input type=radio>item1<BR><input type=radio checked>item2<BR><input type=radio>item3<BR></form>就成了 bencalie(Bencalie) 的第二种方法不错!很好! <select disabled><option>ksldfsl</option></select> 哪位大神帮我看看,一个javascript正则表达式分组问题,我已经弄了两天了,谢谢了 如何理解方法中的this? 帮忙解决一下问题 photofunia 网站技术 怎么把<select>下拉列表中的选项全部删掉呢? 如何快速实现这样导航条的效果?有没有工具? 如何通过程序保存一个网页? 检查checkbox的值的问题,谢谢 高手们,有谁研究过如下的脚本语言?? 急救,我快不行了........... select 的问题! 急!如何在函数中使用参数,此参数是某个窗体元素的id,然后实现此窗体元素的调用
<option>abc
<option selected>def
<option>ghi
</select>
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>
<select onchange="this.selectedIndex=1">
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>法2:
<style>
select{falcon:expression(selectedIndex=0)}
</style>
<select>
<option>1</option>
<option>2</option>
</select>
<select >
<option>1</option>
<option>2</option>
</select>
法3:
<style>
select.s1{falcon:expression(selectedIndex=0)}
</style>
<select class="s1">
<option>1</option>
<option>2</option>
</select>
<select >
<option>1</option>
<option>2</option>
</select>
<select onbeforeactivate="return false">
<option>a
<option selected>b
<option>c
</select>
http://webfx.eae.net
javascript:alert(document.getElementsByTagName("select")[0].selectedIndex=0);
会使方法一失效。
当然,也能使用相同的方法(键入其它命令)使方法二和方法三失效。我的笨方法是定时设置:
<form name=thisform>
<select name=sel>
<option>1</option>
<option>2</option>
</select>
</form>
<script>
setInterval("thisform.sel.selectedIndex=1", 100);
</script>
<option>1</option>
<option selected>2</option>
<option>3</option>
</select>OR<select onchange="selectedIndex=this.defaultChecked">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<input type=checkbox onfocus="this.blur()" onclick="checked=defaultChecked">对radio呢:
<input type=radio name="test" onclick="event.returnValue=false" checked>
<input type=radio name="test" onclick="event.returnValue=false">还没想到什么简单直捷的方法。对只要view的页面我是干脆不写name来实现readonly的,要是需要submit的页面我想就只好用脚本来维护选中状态了。
中的onclick部分是错的。我还没想出对的写法。
<form ...>
<input type=radio name=emu value=1>item1<BR>
<input type=radio name=emu value=2 checked>item2<BR>
<input type=radio name=emu value=3>item3<BR>
</form>改为:
<form ...>
<input name=emu value=2 type=hidden>
<input type=radio>item1<BR>
<input type=radio checked>item2<BR>
<input type=radio>item3<BR>
</form>就成了
很好!
<option>ksldfsl</option>
</select>