织梦 自定义表单 提交不为空验证由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“织梦后台自定义表单”。
自定义表单 提交不为空验证
/plus/diy.php“ method=”post“ name=”form1“ id=”form1“ onSubmit=”return isEmpty();“ >
function isEmpty(){
var addform = document.form1;
if(addform.title.value==”“){
alert(”标题不能为空!“);
addform.title.focus();
return false;
}
if(addform.content.value==”“){
alert(”留言内容不能为空!“);
addform.content.focus();
return false;
}
if(addform.name.value==”“){
alert(”姓名不能为空!“);
addform.name.focus();
return false;
}
if(addform.tel.value==”“){
alert(”电话不能为空!");
addform.tel.focus();
return false;
}
return true;
}