源代码如下:请检查!
<script language="javascript">
function mycheck(){
if(form1.xingming.value == "")
{alert("请输入姓名!");form1.xingming.focus();return;}
if(form1.idcard.value == "")
{alert("请输入身份证号!");form1.idcard.focus();return;}
if(form1.phone.value == "")
{alert("请输入联系电话!");form1.phone.focus();return;}
form1.submit();
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>资料查询</title>
<style type="text/css">
<!--
.ff{border-color:#993333;border:1px solid; height:18px; width:120px;
color: #993333;
font-size: 12px;
}
.dd{border-color:#999999;border:1px solid; height:15px; width:410px;
color: #666666;
font-size: 12px;
}
.bb{
height:13px;
width:50px;
color: #C17A75;
font-size: 12px;
border-top: 1px none #999999;
border-right: 1px none #999999;
border-bottom: 1px none #999999;
border-left: 1px none #999999;
}
.cc{border-color:#999999;border:1px solid; height:15px; width:400px;
color: #666666;
font-size: 12px;
}
.ee{border-color:#999999;border:1px solid; height:15px; width:214px;
color: #666666;
font-size: 12px;
}
.style3 {
color: #993300;
font-size: 12px;
}
-->
</style>
<link href="photo/border.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style7 {color: #B25A52}
.style8 {
color: #C17A75;
font-weight: bold;
font-size: 14px;
}
-->
</style>
</head>
<body topmargin="4" leftmargin="3">
<table width="512" height="298" border="0" cellpadding="0" cellspacing="0" class="style3">
<!--DWLayoutTable-->
<tr>
<td width="512" height="310" valign="top"><table width="516" height="289" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="161" colspan="2" valign="top"><table width="99%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="506" height="158" align="center" valign="top"><table width="504" height="138" border="0" cellpadding="0" cellspacing="2">
<!--DWLayoutTable-->
<tr>
<td width="207" height="154" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<form name="form1" method="post" action="searchhrres.asp" id="form1">
<tr valign="middle">
<td height="27" colspan="6" align="center" class="style7"><span class="style8">个人资料查询</span></td>
</tr>
<tr>
<td width="23" height="2"></td>
<td width="2"></td>
<td width="54"></td>
<td width="2"></td>
<td width="120"></td>
<td width="7"></td>
</tr>
<tr>
<td height="26" valign="middle"><input type="radio" name="person" value="1" ></td>
<td colspan="3" class="style3">姓 名</td>
<td valign="middle"><input type="text" name="xingming"class="ff"></td>
<td> </td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" valign="middle"><input type="radio" name="person" value="2"></td>
<td colspan="3" class="style3">身份证号</td>
<td valign="middle"><input type="text" name="idcard"class="ff"></td>
<td></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" valign="middle"><input type="radio" name="person" value="3" ></td>
<td colspan="3" class="style3">联系电话</td>
<td valign="middle"><input type="text" name="phone"class="ff"></td>
<td></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="41" colspan="4" align="center" valign="middle"><div align="right">
<input class="style3" type="reset" name="Submit2" value="清除">
</div></td>
<td align="center" valign="middle"> <input class="style3" type="button" name="button1" value="提交" onClick="mycheck();"> </td>
<td></td>
</tr></form>
</table></td>
<td width="84"> </td>
<td width="203" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<form name="form2" method="post" action="searchres.asp" id="form2">
<tr>
<td height="27" colspan="5" align="center" valign="middle" class="style8">工作记录查询</td>
</tr>
<tr>
<td width="30" height="2"></td>
<td width="2"></td>
<td width="69"></td>
<td width="2"></td>
<td width="124"></td>
</tr>
<tr>
<td height="26" valign="middle" class="style3"><input type="radio" name="job2" value="job1"></td>
<td colspan="3" class="style3">起始日期</td>
<td valign="middle" class="style3"><input type="text" name="startdate"class="ff" value="格式:2002-12-31" onClick="Javascript:this.value=''"></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" valign="middle"><!--DWLayoutEmptyCell--> </td>
<td colspan="3" class="style3">终止日期</td>
<td valign="top"><input type="text" name="enddate"class="ff" value="格式:2006-12-12" onClick="Javascript:this.value=''"></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" valign="middle"><input type="radio" name="job" value="job3"></td>
<td colspan="3" class="style3">工作内容</td>
<td valign="top"><input type="text" name="jobrecord"class="ff"></td>
</tr>
<tr>
<td height="2"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="41" colspan="4" align="center" valign="middle"><div align="right">
<input class="style3" type="reset" name="Submit3" value="清除">
</div></td>
<td align="center" valign="middle"><input class="style3" type="submit" name="button2" onClick="mycheck1()" value="提交"></td>
</tr></form>
</table></td>
</table></td>
</tr>
<tr>
<td height="3"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="504" height="128" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
<!--DWLayoutTable-->
<tr>
<td width="510" height="130" valign="top"><Iframe src="search.htm" marginheight="0" marginwidth="0" align=right width="503" height="130" scrolling="no" Noresize frameborder="0" name="searchres"></iframe></td>
</tr>
</table></td>
<td width="6"></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
我想对其中的单选按钮与文本框内容进行判断,希望如添了文本,没选择单选按钮提出提示!
或选择了单选按钮没有在相应的文本框中填入内容的进行判断。。。。
谢谢了!
[此贴子已经被作者于2006-12-26 21:26:27编辑过]