HTML表格中怎么用聚焦focus
程序没有运行denglu()这一函数<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册账号</title>
</head>
<body >
<script type="text/javascript" >
function denglu(){
if(document.getElementsByName("yonghu").value=="用户名/手机号/邮箱"){
window.alert("用户名不能为空");
document.getElementById('yonghu').focus();
return false;
}
if(document.getElementsByName("yonghu").value<=2){
window.alert("用户名不能少于2");
document.getElementById('yonghu').focus();
return false;
}
}
</script>
<table>
<tr>
<td><input type="text" name="yonghu" value="用户名/手机号/邮箱" onFocus="if (value =='用户名/手机号/邮箱'){value =''}"onblur="if (value ==''){value='用户名/手机号/邮箱'}"></td>
<td><input type="button" value="验证" onClick="return denglu()"></td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2015-12-7 18:33编辑过]