发布网友
共1个回答
热心网友
js方法:
function check(){
var name = document.getElementById("name").value;
if(name == null || name == ''){
alert("用户名不能为空");
return false;
}
return true;
}
<form name="form" action="跳转的页面" method="post" onsubmit="return check()">
<input type="text" id="name"/>
<input type="sumit" value="提交"/>
</form>