我现在有一个select文本框,另有一个input文本框,我想在select文本框选择了某项后,input文本框才能接收用户的输入,否则隐藏(或不可输入),我应该怎么办?
请教各位大侠了……
------解决方案--------------------
select框里面加上onchange事件,触发js函数判断select里面是不是你要的值,不是就把文本框设置readonly=true或者disabled=true,反之设置为false
------解决方案--------------------
和LS一样的意见
------解决方案--------------------
function changvalue(opt){
var para = opt.value;
if(para== "首期 "){
document.form.Prem.readonly=true;
}
//下面的自己补
}
<select name= "PayKind " onchange= "changvalue(this) ">
<option> 首期 </option>
</select>
<input name= "Prem " type=text>
------解决方案--------------------
具体的数据楼主自己改
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> </title>
</head>
<script language= "javascript ">
function sel(selec)
{
if(selec.value== "2001 "){
selec.form.inp.style.visibility = "visible ";
}else
selec.form.inp.style.visibility = "hidden ";
}
</script>
<body>
<form>
<select onChange= "sel(this) ">
<option value= "2000 "> 2000 </option>
<option value= "2001 "> 2001 </option>
</select>
<input name= "inp " type= "text " size= "20 " style= " visibility:hidden; ">
</form>
</body>
</html>