asp按钮判断
<scriptlanguage="JavaScript">functioncheckit(){if(document.form1.radiobutton.value!=1...
<script language="JavaScript">
function checkit()
{
if(document.form1.radiobutton.value!=1)
{
if(document.form1.col_info1.value=="")
{
alert("请输入答案!");
document.form1.col_info1.focus();
return false;
}
}
}
</script>
<form method="POST" name=form1 action="111.asp" onSubmit="return checkit();">
<tr height="25" bgcolor="#CCCCCC">
<td height="34" colspan="4" background="../images/back1.gif">3、答案 </td>
</tr>
<tr>
<td height="50"colspan="4" >
<label> <input name="radiobutton" type="radio" value="1" checked> </label>有
<label><input type="radio" name="radiobutton" value="2" >无</label>
</td></tr>
<tr>
<td height="138" colspan="4"><textarea name="col_info1" cols="100" rows="10" id="col_info1"></textarea></td>
</tr>
<p><input type="submit" value="提交" name="B1"></p>
</form>
怎么实现当选择“有”单选按钮是,如果不填写表格提示填写,选择“无”时直接通过,不需要填写,我那里编错了!希望高手指导 展开
function checkit()
{
if(document.form1.radiobutton.value!=1)
{
if(document.form1.col_info1.value=="")
{
alert("请输入答案!");
document.form1.col_info1.focus();
return false;
}
}
}
</script>
<form method="POST" name=form1 action="111.asp" onSubmit="return checkit();">
<tr height="25" bgcolor="#CCCCCC">
<td height="34" colspan="4" background="../images/back1.gif">3、答案 </td>
</tr>
<tr>
<td height="50"colspan="4" >
<label> <input name="radiobutton" type="radio" value="1" checked> </label>有
<label><input type="radio" name="radiobutton" value="2" >无</label>
</td></tr>
<tr>
<td height="138" colspan="4"><textarea name="col_info1" cols="100" rows="10" id="col_info1"></textarea></td>
</tr>
<p><input type="submit" value="提交" name="B1"></p>
</form>
怎么实现当选择“有”单选按钮是,如果不填写表格提示填写,选择“无”时直接通过,不需要填写,我那里编错了!希望高手指导 展开
2个回答
展开全部
<script language="JavaScript">
function checkit()
{
if(document.form1.radiobutton[0].checked==true)
{
if(document.form1.col_info1.value=="")
{
alert("请输入答案!");
document.form1.col_info1.focus();
return false;
}
}
}
</script>
<form method="POST" name=form1 action="111.asp" onSubmit="return checkit();">
<tr height="25" bgcolor="#CCCCCC">
<td height="34" colspan="4" background="../images/back1.gif">3、答案 </td>
</tr>
<tr>
<td height="50"colspan="4" >
<label> <input name="radiobutton" type="radio" value="1" checked> </label>有
<label><input type="radio" name="radiobutton" value="2" >无</label>
</td></tr>
<tr>
<td height="138" colspan="4"><textarea name="col_info1" cols="100" rows="10" id="col_info1"></textarea></td>
</tr>
<p><input type="submit" value="提交" name="B1"></p>
</form>
function checkit()
{
if(document.form1.radiobutton[0].checked==true)
{
if(document.form1.col_info1.value=="")
{
alert("请输入答案!");
document.form1.col_info1.focus();
return false;
}
}
}
</script>
<form method="POST" name=form1 action="111.asp" onSubmit="return checkit();">
<tr height="25" bgcolor="#CCCCCC">
<td height="34" colspan="4" background="../images/back1.gif">3、答案 </td>
</tr>
<tr>
<td height="50"colspan="4" >
<label> <input name="radiobutton" type="radio" value="1" checked> </label>有
<label><input type="radio" name="radiobutton" value="2" >无</label>
</td></tr>
<tr>
<td height="138" colspan="4"><textarea name="col_info1" cols="100" rows="10" id="col_info1"></textarea></td>
</tr>
<p><input type="submit" value="提交" name="B1"></p>
</form>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询