当前位置: 代码迷 >> Web前端 >> 非活性旋钮
  详细解决方案

非活性旋钮

热度:145   发布时间:2012-12-14 10:33:08.0
非活性按钮
<html>
	<head>
		<title>Login</title>
		<script type="text/javascript" src="show.js">
		</script>
	</head>
	<body>
		<table>
			<tr>
				<td>
					用户名:
				</td>
				<td>
					<input type="text" name="userId" id="userId" style="width: 150px" maxlength="9"/>
				</td>
			</tr>
			<tr>
				<td>
					密  码:
				</td>
				<td>
					<input type="password" name="password" style="width: 150px;" size="20" id="password" onkeyup="javascript:show()"/>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<input type="button" name="submit" style="width: 50px; height: 25" value="登陆" id="submit" disabled />
				</td>
			</tr>
		</table>
	</body>
</html>


show.js

			function show(){
				var userId = document.getElementById("userId").value;
				var password = document.getElementById("password").value;
				if(userId =="" || password ==""|| userId ==null || password ==null){
					document.getElementById("submit").disabled=true;
				}else{
					document.getElementById("submit").disabled=false;
				}
			}


 

  相关解决方案