function CheckForm() { Telcheck = /^[\d-() ]*$/ Mailcheck = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ Numcheck = /^\d{1}$/ if(document.form1.name.value == "") { alert("\Please Enter Your Name!\n"); return false; } if(document.form1.tel.value == ""||!Telcheck.test(document.form1.tel.value)) { alert("\Please Enter Valid Tel Number Using the format we give!\n"); return false; } if(!Mailcheck.test(document.form1.email.value)) { alert("\Please make sure you have the @ symbol in the e-mail address and e-mail address ends with .com or .net or other valid suffix!\n"); return false; } }这个是js的一般php的话,最好用什么语句来控制?一样用正则么?
{
Telcheck = /^[\d-() ]*$/
Mailcheck = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
Numcheck = /^\d{1}$/
if(document.form1.name.value == "")
{
alert("\Please Enter Your Name!\n");
return false;
}
if(document.form1.tel.value == ""||!Telcheck.test(document.form1.tel.value))
{
alert("\Please Enter Valid Tel Number Using the format we give!\n");
return false;
}
if(!Mailcheck.test(document.form1.email.value))
{
alert("\Please make sure you have the @ symbol in the e-mail address and e-mail address ends with .com or .net or other valid suffix!\n");
return false;
}
}这个是js的一般php的话,最好用什么语句来控制?一样用正则么?
if (isset($reg_info[''])){
echo "不允许提交空值"
}这样把
if(document.form1.name.value == "")
{
alert("\Please Enter Your Name!\n");
return false;
}我会用类似input=document.getElementById(),然后value=input.value这样的方法。