Skip to content

Instantly share code, notes, and snippets.

@hare1987
Created September 16, 2011 07:19
Show Gist options
  • Save hare1987/1221429 to your computer and use it in GitHub Desktop.
Save hare1987/1221429 to your computer and use it in GitHub Desktop.
脚本验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
function checkregform(){
alert("验证开始了!");
if (yx.name.value==""){
alert("请填写宝宝的姓名!");
yx.name.focus();
return false;
}
if (yx.tel.value=="" || yx.tel.value.length <11 || yx.tel.value.length > 12 || isNaN(yx.tel.value)){
alert("请正确填写联系电话!");
yx.tel.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form id="yx" name="yx" onsubmit="return checkregform()" method="post" action="save.asp?action=gf">
<li>宝宝姓名:<input type="text" style="width:105px" id="name" name="name"></li>
<li>宝宝年龄:<select style="width:42px" id="lngsex" name="age">
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</li>
<li>预约校区:<select style="width:100px" id="school" name="school">
<option value="徐汇田林校">徐汇田林校</option>
<option value="黄浦书城校">黄浦书城校</option>
<option value="浦东金桥校">浦东金桥校</option>
<option value="闵行莘庄校">闵行莘庄校</option>
<option value="虹口东宝校">虹口东宝校</option>
<option value="长宁虹桥校">长宁虹桥校</option>
<option value="松江九亭校">松江九亭校</option>
<option value="宝山大华校">宝山大华校</option>
</select>
</li>
<li>联系电话:<input type="text" style="width:105px" id="tel" name="tel"></li>
<div align="center"><input type="submit" value="预约" /></div>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment