FORM表单怎样让submit验证指定数据,验证成功后怎么提交至指定页面中呢?

发布网友

我来回答

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>

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com