function Juge()
{
var flag=false; //是否有选择
for(i=0;i<document.sendresume.elements.length;i++)
{
if (document.sendresume.elements[i].name=="resumeid")
{
if (document.sendresume.elements[i].checked==true)
{
flag=true;
break;
}
}
}
if (flag==false)
{
alert("请选择一项!");
return false;
}}
<form name="sendresume" method="POST" action="a.asp" onSubmit="return Juge()"> <input type=radio value='0' name=resumeid >
<input type=radio value='1' name=resumeid ><input name=Submit src='../company/images/img55.gif' type=image value='' width='198' height='27' hidefocus <%if a=1 then%> ONCLICK=""vbScript:if msgbox('您已经申请1次,您确定要重新申请吗?',4,'') = 6 then window.location.href='b.asp' end if <% end if %>"">这样子的代码.当用户没有选中一个单选框而且a=1的话.他就会弹出两次警告框.我想当用户没有选中单选框,而且a=1时,他只弹出一个."请选择一项"的提示.当用户选择了一项,再点击按纽时,他再弹出,曾经申请过一次的提示.当然如果a<>1时,他也弹出一个"请选择一项"的提示了.请指教!
{
var flag=false; //是否有选择
for(i=0;i<document.sendresume.elements.length;i++)
{
if (document.sendresume.elements[i].name=="resumeid")
{
if (document.sendresume.elements[i].checked==true)
{
flag=true;
break;
}
}
}
if (flag==false)
{
alert("请选择一项!");
return false;
}}
<form name="sendresume" method="POST" action="a.asp" onSubmit="return Juge()"> <input type=radio value='0' name=resumeid >
<input type=radio value='1' name=resumeid ><input name=Submit src='../company/images/img55.gif' type=image value='' width='198' height='27' hidefocus <%if a=1 then%> ONCLICK=""vbScript:if msgbox('您已经申请1次,您确定要重新申请吗?',4,'') = 6 then window.location.href='b.asp' end if <% end if %>"">这样子的代码.当用户没有选中一个单选框而且a=1的话.他就会弹出两次警告框.我想当用户没有选中单选框,而且a=1时,他只弹出一个."请选择一项"的提示.当用户选择了一项,再点击按纽时,他再弹出,曾经申请过一次的提示.当然如果a<>1时,他也弹出一个"请选择一项"的提示了.请指教!
function Juge()
{ if(confirm('您已经申请1次,您确定要重新申请吗?')){
location.href='b.asp'
return false
}
var flag=false; //是否有选择
for(i=0;i <document.sendresume.elements.length;i++)
{
if (document.sendresume.elements[i].name=="resumeid")
{
if (document.sendresume.elements[i].checked==true)
{
flag=true;
break;
}
}
}
if (flag==false)
{
alert("请选择一项!");
return false;
} }
</script><form name="sendresume" method="POST" action="a.asp" onSubmit="return Juge()"> <input type=radio value='0' name=resumeid >
<input type=radio value='1' name=resumeid > <input name=Submit src='../company/images/img55.gif' type=image value='' width='198' height='27' hidefocus> 这个意思?