<!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=gb2312" />
<title>无标题文档</title>
<script language="vbscript">
<!--
function checkphone(str1)
dim i,tmp_char,tmp_str
tmp_str=trim(str1)
for i=1 to len(tmp_str)
tmp_char=mid(tmp_str,i,1)
if(asc(tmp_char)<asc("0") or asc(tmp_char)>asc("9")) then
checkphone=false
exit function
end if
next
checkphone=true
end function
function checkemail(str1)
dim temp
temp=instr(str1,@)
if temp=0 then
checkemail=false
exit function
end if
checkemial=true
end function
sub checkdata()
dim i
i=1
do
select case i
case 1
if frm1.name.value="" then
msgbox "姓名不得为空!",0+16,"warning"
exit sub
end if
case 2
case 3
if frm1.address.value="" then
msgbox "联系地址不得为空!",0+16,"warning"
exit sub
end if
case 4
if(frm1.phone.value="")or(checkphone(frm1.phone.value)=false) then
msgbox "电话号码不得为空或输入非法",0+16,"warning"
exit sub
end if
case 5
if(frm1.email.value=="")or(checkemail(frm1.email.value)=false) then
msgbox "输入不得为空或输入非法",0+16,"warning"
exit sub
end if
end select
i=i+1
loop while i<6
frm1.submit
end sub
-->
</script>
</head>
<body>
<form method="post" name="frm1">
<table width="750" height="181" border="0" align="center">
<tr>
<td>姓名:
<label>
<input type="text" name="name" />
</label>
*</td>
</tr>
<tr>
<td>年龄:
<label>
<input type="text" name="age" />
*</label></td>
</tr>
<tr>
<td>公司或集体:
<label>
<input type="text" name="company" />
</label></td>
</tr>
<tr>
<td>联系地址:
<label>
<input type="text" name="address" />
</label></td>
</tr>
<tr>
<td>联系电话:
<label>
<input type="text" name="phone" />
*</label></td>
</tr>
<tr>
<td>email:
<label>
<input type="text" name="email" />
</label></td>
</tr>
</table>
<input type="submit" name="submit1" value="提交" onclick="checkdata"/>
</form>
</body>
</html>
[此贴子已经被作者于2007-3-25 16:26:18编辑过]