< html > < head > < title > study 034 </ title > < script language ="javascript" type ="text/javascript" > ... function validate()...{ if (document.form1.yourname.value.length < 1) ...{ alert("请输入正确的姓名。"); return false; } if (document.form1.address.value.length < 3) ...{ alert("请输入正确的地址。"); return false; } if (document.form1.phone.value < 3) ...{ alert("请输入正确的电话"); } return true;} </ script > < body > < h1 > 发送邮件 </ h2 > < form name ="form1" action ="mailto:user@host.com" enctype ="text/plain" method ="post" onSubmit ="return validate();" > < p >< b > 姓名: </ b >< input type ="text" size ="20" name ="yourname" ></ p > < p >< b > 地址: </ b >< input type ="text" size ="20" name ="address" ></ p > < p >< b > 电话: </ b >< input type ="text" size ="20" name ="phone" ></ p > < p >< input type ="submit" value ="提交" ></ p > </ form ></ body > </ html >