写了个用jquery控制select只读(select选项可以供用户查看但不能改变初始选中值)
转载自:
http://www.cnblogs.com/case/articles/1864500.html
<
script
type
=
"text/javascript"
src
=
"
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></
script
>
<
select
readonly
=
"readonly"
f
=
"BugTypeID"
id
=
"selectTest"
name
=
"BugTypeID"
>
<
option
value
=
"11"
>代码错误</
option
>
<
option
value
=
"12"
>用户界面</
option
>
<
option
value
=
"13"
>需求变动</
option
>
<
option
value
=
"14"
>新增需求</
option
>
<
option
value
=
"15"
selected
=
"selected"
>设计文档</
option
>
<
option
value
=
"16"
>配置相关</
option
>
<
option
value
=
"17"
>安装部署</
option
>
<
option
value
=
"18"
>安全相关</
option
>
<
option
value
=
"19"
>性能压力</
option
>
<
option
value
=
"20"
>标准规范</
option
>
<
option
value
=
"21"
>测试脚本</
option
>
<
option
value
=
"22"
>事务跟踪</
option
>
<
option
value
=
"23"
>其他</
option
>
</
select
>
<
script
>
$.fn.selectReadOnly=function(){
var tem=$(this).children('option').index($("option:selected"));
$(this).change(function(){
$(this).children('option').eq(tem).attr("selected",true);
});
}
$("select:[readonly='readonly']").selectReadOnly();
</
script
>