html代码
想得到的效果是:1=,2,3|4=,5,6,7

解决方案 »

  1.   

    分别去除pid为和4的然后再组装
      

  2.   

    怎么不copy代码进来  弄一张图片 复制都复制不到。
      

  3.   


        <tr>
               <td>订单管理</td>
               </tr>
               <tr>
               <td>
                   <input type="hidden" value="1" id="pper1" name="pper"/>
                   
                    <input type="checkbox" name="per" value="2" pid="1" id="per2" />门票订单管理&nbsp;
                    
                    <input type="checkbox" name="per" value="3" pid="1" id="per3" />套餐订单管理&nbsp;
                    
               </td>
               </tr>
               
               <tr>
               <td>网站常规管理</td>
               </tr>
               <tr>
               <td>
                   <input type="hidden" value="4" id="pper4" name="pper"/>
                   
                    <input type="checkbox" name="per" value="5" pid="4" id="per5" />热门标签管理&nbsp;
                    
                    <input type="checkbox" name="per" value="6" pid="4" id="per6" />城市管理&nbsp;
                    
                    <input type="checkbox" name="per" value="7" pid="4" id="per7" />flash图片管理&nbsp;
                    
                    <input type="checkbox" name="per" value="8" pid="4" id="per8" />友情链接管理&nbsp;
                    
                    <input type="checkbox" name="per" value="9" pid="4" id="per9" />网站页脚管理&nbsp;
                    
                    <input type="checkbox" name="per" value="10" pid="4" id="per10" />图片管理&nbsp;
                    
               </td>
               </tr>
      

  4.   


    <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
    $(function(){
    var str1="";
    var str2="";
    $("input[name='per']").each(function(index, element) {
                    if($(this).attr("pid")==1){
    str1+=","+$(this).val();
    }
     if($(this).attr("pid")==4){
    str2+=","+$(this).val();
    }
                });
    alert(str1+"|"+str2);
    });
    </script>
      

  5.   

    无语了
    <script type="text/javascript">
    $(function(){
    var str="";
    $("input[name='pper']").each(function(index, element) {
    var pid=$(this).val();
                    $("input[name='per']").each(function(index, element) {
                    if($(this).attr("pid")==pid){
    str+=","+$(this).val();
    }
                 });
     str+="|";
                });
    if(str!=""){
      str = str.substring(0,str.length-1);
        }
    alert(str);
    });
    </script>
      

  6.   

    亲,光靠别人不好哟!!怎么不自己改改
    $(function(){
    var str="";
    $("input[name='pper']").each(function(index, element) {
    var pid=$(this).val();
    str +=pid+"=";
                    $("input[name='per']").each(function(index, element) {
                    if($(this).attr("pid")==pid){
    str+=","+$(this).val();
    }
                 });
     str+="|";
                });
    if(str!=""){
      str = str.substring(0,str.length-1);
        }
    alert(str);
    });