控制input输入的三种方法(一js实现)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script language="Javascript">
function hide() {
var mode = document.getElementById("mode");
var hykhLk = document.getElementById("hykh_lk");
if (mode.value != 1)
{
hykhLk.setAttribute("readOnly",true);
hykhLk.style.backgroundColor="#d2d2d2";
}
else
{
hykhLk.removeAttribute("readOnly");
hykhLk.style.backgroundColor="#ffffff";
}
}
</script>
</head>
<body>
<select name="mode" id="mode" class="dept_select" style="width: 100px;" onClick="hide()">
<option value="1" #if($resultMap.mode==1)selected#end>离场车辆</option>
<option value="2" #if($resultMap.mode==2)selected#end>进场车辆</option>
<option value="3" #if($resultMap.mode==3)selected#end>滞留车辆</option>
</select>
<input type="text" name="hykh_lk" id="hykh_lk" value="124" style="width: 100px;" class="text"/>
</body>
</html>