function funturn()
{
if(document.getElementsByName("postvote")[0].checked)
{
if(!confirm("确定选择1号?")) return;
}
else if(document.getElementsByName("postvote")[1].checked)
{
if(!confirm("确定选择2号?")) return;
}
else
{
alert("没有选择");
return;
}
window.location.href="voting.asp"
}
{
if(document.getElementsByName("postvote")[0].checked)
{
if(!confirm("确定选择1号?")) return;
}
else if(document.getElementsByName("postvote")[1].checked)
{
if(!confirm("确定选择2号?")) return;
}
else
{
alert("没有选择");
return;
}
window.location.href="voting.asp"
}
<body>
<script language="JavaScript">
function funturn(){
postvoteobj = document.getElementsByName("postvote");
for (i=0;i<postvoteobj.length;i++)
{
if (postvoteobj[i].checked)
{
str = postvoteobj[i].value;
alert("确定选择"+str+"?");
window.location.href="voting.asp";
}
}
return false;
}
</script>
<form action="a.asp" method="post">
<input type="radio" name="postvote" value="1号" >1号
<input type="radio" name="postvote" value="2号" >2号
<input type="submit" name="Submit" value="OK!提交!" onclick="return funturn();">
</body>
</html>
...FUNCTION TestFunction()
{
...//自己搞定
if (...)
return true;
if(...)
return false;
}只要手动调用ONSUBMIT()函数就可以了