用这段代码测试了下,没什么问题就是在firefox2下不能清空selct ie和opera没问题
是不是其他的地方干扰了程序啊<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function $(strId){
return document.getElementById(strId);
}function alloweditable(source,target){
source = document.getElementById(source);
target = document.getElementById(target);
if(source.checked == false) {
target.disabled = true;
target.value = "";
}else{
target.disabled = false;
target.focus();
}
}
</script>
</head>
<body>
<input type="checkbox" id="chk1" onclick="alloweditable('chk1','sel1')"/><BR/>
<!--<input type="text" id="txt1"/>-->
<select id="sel1" disabled="disabled">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>
</body>
</html>
是不是其他的地方干扰了程序啊<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function $(strId){
return document.getElementById(strId);
}function alloweditable(source,target){
source = document.getElementById(source);
target = document.getElementById(target);
if(source.checked == false) {
target.disabled = true;
target.value = "";
}else{
target.disabled = false;
target.focus();
}
}
</script>
</head>
<body>
<input type="checkbox" id="chk1" onclick="alloweditable('chk1','sel1')"/><BR/>
<!--<input type="text" id="txt1"/>-->
<select id="sel1" disabled="disabled">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货