如果要传递的话必须要用 myname[]javascript的话就用 elements

解决方案 »

  1.   

    看看http://expert.csdn.net/Expert/topic/2490/2490970.xml?temp=.234173里面 entice(踏雪寻梅) 的回复
      

  2.   

    it depends on which way you prefer to useOption 1. post the array from form to server side php
    Option 2. onsubmit event to javascript, to unserilize 
    the array to a string, post the string to server side
    php.
      

  3.   

    javascript 可以像
    alert(form.elements['myname[]']);
    这样处理。
      

  4.   

    给你一个例子:
    <script>
    function checkboxNums(tagsname,typename,exception){
    var o=document.all.tags(tagsname);
    Nums=0
    for(var i=0;i<o.length;i++){
    if(o[i].type==typename){
    if (o[i].name!=exception) {
    if (o[i].checked==true) Nums++;
    }
    }
    }
    return Nums;
    }
    function edit(page){
    Nums=0;
    Nums=checkboxNums("INPUT","checkbox","checkboxall");
    if (Nums==0){
    alert("您至少选择一个。");
    }else{
    document.f3.submit();
    }
    }
    </script>
    <body bgcolor="#74ddff" text="#000000" rightmargin=0 leftmargin=0 topmargin=6>
    <a href="javascript:edit();">提交,至少选择一个</a>
    <form name=f3 method=post>
    <input type=checkbox id=check_1 name="selected_id[]" value="项目一">项目一<br>
    <input type=checkbox id=check_2 name="selected_id[]" value="项目二">项目二<br>
    <input type=checkbox id=check_3 name="selected_id[]" value="项目三">项目三<br>
    </form><br><br>
    <?
    echo "你的选择是:<br>";
    $dnums=count($_POST['selected_id']);
    if ($dnums > 0){
    for($i=0;$i<$dnums;$i++) echo $_POST['selected_id'][$i]."<br>";
    }
    ?>
    </table>
      

  5.   

    在HTML中,可能用数组的方式在最后的选项中插入一个隐藏的域,也就是一个数组结束的标志,这样传入时就可以直接检测了!
      

  6.   

    var SelectedItem=document.getElementById("SelectedItem");
      for(var i=0;i<SelectedItem.options.length;i++){
    SelectedItem.options[i].selected = true;
        }
      document.frmSelectItem.submit(); 也就是说,你把所有要传的option都选中就可以传过去了
      

  7.   

    你可以用php中的数组
    首先在第一页中有四个
    echo "<td><input type=checkbox value='1' name=check[]></td>";
    选项
    然后传过之后
    for(i=0;i<=4;i++){ if($_POST["check"][i])
        //   进行答案的处理
    }