我现在刚学 只会一个一个添加button 如何整合单一起就不会了
如何把多个button整合到一起 且如果输入内容不符合正测表达式 再点击“提交”时 会出现alert提示“所输入的内容错误”
非常感谢
<html>
<head>
<title>登记表</title>
</head>
<body>
<form action="" id="myform">
<table align="center">
<tr><td font_size="100">登记表</td></tr>
<tr>
<td>用户名:</td>
<td><input type="text" id="name"></td>
</tr>
<tr>
<td>性别:</td>
<td><input type="radio" name="sex" id="man" value="m"/>男
<input type="radio" name="sex" id="women" value="f"/>女
</td>
</tr>
<tr>
<td>电子邮箱:</td>
<td><input type="text" id="email"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="button" value="提 交" onClick="checkEmail()">
</td>
</tr>
<tr>
<td>手机号码:</td>
<td><input type="text" id="mobileNo"></td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="button" value="提 交" onClick="checkmobile()">
</td>
</tr>
<tr>
<td>固定电话:</td>
<td><input type="text" id="phoneNo"></td>
<tr>
<td align="center" colspan="2">
<input type="button" value="提交" onclick="checkphone()"></td>
</tr>
<tr>
<td>身份证号</td>
<td><input type="text" id="IDNo"></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="button" value="提交" onclick="checkID()"></td>
</tr>
</form>
<script language="javascript">
function checkEmail()
{
var email = document.getElementById("email");
if(email.value==null||email.value=="")
{
alert("请输入E-mail地址!");
email.focus();
return;
}
var regExpression = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
var objExp = new RegExp(regExpression);
if(objExp.test(email.value)==false)
{
alert("您输入的E-mail地址不正确!");
email.focus();
return;
} document.getElementById("myform").submit();
}
</script>
<script language="javascript">
function checkmobile()
{ var mobileNo = document.getElementById("mobileNo");
var regExpression = /^(86)?((13\d{9})|(15[0,1,2,3,5,6,7,8,9]\d{8})|(18[0,5,6,7,8,9]\d{8}))$/;
if(!regExpression.test(mobileNo.value))
{ alert("您输入的手机号码有误!");
mobileNo.focus();
return;} document.getElementById("myform").submit();
}
</script>
<script language="javascript">
function checkphone()
{
var phoneNo=document.getElementById("phoneNo");
var regExpression=/^((\d{3})-)?((\d{7})|(\d{8}))$/;