<body>
<div class="reg">
<form>
<div class="a">手机号<input type="number" value="" id="num" class="num" onmouseout="try()"/></div>
<div class="b">邮箱<input type="text" value="" class="email" id="email" onmouseout="try2()"/></div>
<div class="c"><input type="submit" value="登录" class="login" /></div>
</form>
</div>
<script>
var num=document.getElementById(num);
var email=document.getElementById(email);
function try() {
if(num.length>10){
alert("请输入正确的电话号码")
}
}
function try2() {
if(email.indexOf("@")<0){
alert("请输入正确的邮箱地址")
}
}
</script>
</body>
这样写js是不是不对?怎么都没效果呢?
请大神指点!!
qq_杀意隆_0
qq_杀意隆_0
qq_杀意隆_0
慕的地6079101
相关分类