Js 用户注册验证
Js用户注册验证<scripttype="text/javascript">functioncheckUserName(){varusername2=document.g...
Js 用户注册验证 <script type="text/javascript">
function checkUserName() {
var username2 = document.getElementsByName("username");
var checkUserNameResult = document.getElementById("checkUserNameResult");
if(username.value=="") {
checkUserNameResult.innerHTML = "用户名不能为空";
} else {
checkUserNameResult.innerHTML = "";
}
}
</script>
<body>
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username" onblur="checkUserName();"/></td>
<td><span id="checkUserNameResult" style="color: red "></span> </td>
</tr>
</body>
为什么这代码不好用,span也inner也不出东西 展开
function checkUserName() {
var username2 = document.getElementsByName("username");
var checkUserNameResult = document.getElementById("checkUserNameResult");
if(username.value=="") {
checkUserNameResult.innerHTML = "用户名不能为空";
} else {
checkUserNameResult.innerHTML = "";
}
}
</script>
<body>
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username" onblur="checkUserName();"/></td>
<td><span id="checkUserNameResult" style="color: red "></span> </td>
</tr>
</body>
为什么这代码不好用,span也inner也不出东西 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询