本帖最后由 peidahong 于 2009-09-21 22:49:10 编辑

解决方案 »

  1.   


    不太会这个,能够帮助我在上面代码基础上完整写下吗?譬如:超链接为www.baidu.com ,谢谢!
      

  2.   

    <head>
    <SCRIPT LANGUAGE="JavaScript">
    var agree = 0;  // 0 means 'no', 1 means 'yes'
    function showLink(){
    if(agree){
    document.getElementById("link").style.display="block";
    }else{
    document.getElementById("link").style.display="none";
    }
    }
    </script>
    </HEAD>
    <!-- -->
    <BODY>
    <center>
    <form name=enableform>
    You can agree to the terms. (just a demo)<br>
    <br>
    <input type=radio name='enable' value='agree' onClick="agree=1;">I agree | <input type=radio name='enable' value='disagree' onClick="agree=0;">I disagree<br>
    <a href="www.baidu.com" name="link" id="link" style="display:none">www.baidu.com</a>
    </form>
    <br>
    <br>
    <input type=submit value="Done!" onclick="showLink();">
    </center>
      

  3.   


    谢谢!基本上是这样,但感觉超链接加在value="Done!"上面会更好些。不要单独显示。
      

  4.   


    <SCRIPT LANGUAGE="JavaScript">
    function done()
    {
        if(1)  //判断条件就不写了,自己写吧
        {return true;}
        return false;
        
    }
    </script>
    </HEAD>
    <!-- -->
    <BODY>
    <center>
    <form name=enableform action="www.163.com" >
    You can agree to the terms. (just a demo)<br>
    <br>
    <input type=radio name='enable' value='agree' onClick="agree=1; document.enableform.box.focus();">I agree | <input type=radio name='enable' value='disagree' onClick="agree=0; document.enableform.box.value='';">I disagree<br>
    <br>
    <br>
    <input type=submit value="Done!" onclick="return done()">
    </form>
    </center>
      

  5.   

    没加上色。我的意思是form要有action='**.com'
      

  6.   

    那就把触发事件改成这样吧:
    function showLink(){
    if(agree) window.location.href="www.baidu.com";
    }
      

  7.   


    谢谢各位哥哥姐姐!问题已经解决。如果触发事件那里不更改的话,我试了下也可以把下面<input type=submit value="Done!" onclick="showLink();">语句改成:
    <input type=submit value="Done!" onclick="if(document.enableform.enable[0].checked) location.href='http://www.baidu.com';return false;">再次感谢!