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"
}

解决方案 »

  1.   

    <html><head><title>abc</title></head>
    <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>
      

  2.   

    <form action="a.asp" method="post"  target="yincang" onsubmit="return TestFunction()">
    ...FUNCTION TestFunction()
    {
    ...//自己搞定
    if (...)
    return true;
    if(...)
    return false;
    }只要手动调用ONSUBMIT()函数就可以了
      

  3.   

    對。。返回true就會使用默認的動作。