IE里不放也行,在NN里可能不行

解决方案 »

  1.   

    ie里我试了,可是不放在form里找不到<input type = radio name = r1>1
    <input type = radio name = r1>2document.all("r1")是undefint而不是object
      

  2.   

    你要用document.all的话,这么写:
    <input id=a type=radio name=radio value=1>1 <input id=b type=radio name=radio value=2>2
    <script>
    alert(document.all("a").value)
    </script>
      

  3.   

    至少不放在form里,后台接受不到
      

  4.   

    我是说,想判断radio哪个被选中,只能循环查找数组,我想写个函数,传进来数组的名字,然后在判断每个元素,传进来的数组名是什么
      

  5.   

    那你可以这样:
    <script>
    function check(VALUE) {
    var radioArr=eval("document.forms[0]."+VALUE);
    var radioValue;
    for(var i=0;i<radioArr.length;i++){
    radioValue=eval("document.forms[0]."+VALUE+"["+i+"]");
    if(radioValue.checked) alert(i+"checked");
    }
    }
    </script>
    <form method="POST" action="--WEBBOT-SELF--">
      <p>
      <input type="radio" value="V1" checked name="R1">
      <input type="radio" value="V1" checked name="R1">
      <input type="radio" value="V1" checked name="R1">
      <input type="radio" value="V1" checked name="R1">  <input type="button" value="提交" name="B1" onclick="check('R1')">
      <input type="reset" value="全部重写" name="B2"></p>
    </form>