就你这网页而言你这样的意义何在? submit()多余了吧

解决方案 »

  1.   

    我的submit()要传递其他的值,我没有写出来而已。
    我只是举个例子,等大家好明白一点!
      

  2.   

    <html>
    <script>
    function getParameters()
    {
    str = location.href.split("?")[1];
    if (str != null) 
    {
    var parameters = str.split("&");
    for (var i=0;i<parameters.length;i++)
    {
    paraName = parameters[i].split("=")[0];
    paraValue = parameters[i].split("=")[1];
    alert("参数"+paraName+"的值是:"+paraValue)
    }
    }
    }
    getParameters()
    </script>
    <form name="form">
    <input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    <input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    </html>
      

  3.   

    to vjlin(伟杰)(蓝色的)还是不明白你的意思
      

  4.   

    <html>
    <form name="form">
    <input type="radio" name="rd" id="r1" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    <input type="radio" name="rd" id="r2" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    <script>
    function getParameters()
    {
      str = location.href.split("?")[1];
      if (str != null) 
      {
        var parameters = str.split("&");
        for (var i=0;i<parameters.length;i++)
       {  
         paraName = parameters[i].split("=")[0];
         paraValue = parameters[i].split("=")[1];
       }
      }
    eval("document.form.r"+paraValue+".checked='true';")
    }
    getParameters()
    </script>
    </html>
      

  5.   

    <html>
    <form name="form">
    <input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    <input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';submit();">
    </html>
    改为
    <html>
    <form name="form">
    <input type="radio" name="rd" value=1 onclick="document.form.action='aa.htm';this.checked='true';return function_name();">
    <input type="radio" name="rd" value=2 onclick="document.form.action='aa.htm';this.checked='true';return  function_name();">
    </html><script>
    function function_name(){
    if() {……;}
                      else{……;}
    }
    </script>
    试试
      

  6.   

    楼上的,你这招不行,早试过了~~其实楼主提供的这个范例不太好,因为执行过submit()以后,后面的this.checked='true'根本就执行不到,而是重新加载aa.htm,这时候如何去判断提交之前用户是点击哪个radio呢 ??除非用asp或者jsp来做,javascript好象困难....关注中!
      

  7.   

    vjlin(伟杰)(蓝色的) 
    已经给出了正解,我收回刚才的话。
    谢谢 vjlin(伟杰)(蓝色的) ,厉害!可以结帖了~!!!
      

  8.   

    为了便于理解,其实也可以写为:<html>
    <script>
    function getParameters()
    {
    str = location.href.split("?")[1];
    if (str != null) 
    {
    var parameters = str.split("&");paraName = str.split("=")[0]; //修改处
    paraValue = str.split("=")[1];//修改处
    alert("参数"+paraName+"的值是:"+paraValue)}
    }
    getParameters()
    </script>
    <form name="form">
    <input type="radio" name="rd" value=1 onclick="document.form.action='aa.html';this.checked='true';submit();">
    <input type="radio" name="rd" value=2 onclick="document.form.action='aa.html';this.checked='true';submit();">
    </html>