zoukankan      html  css  js  c++  java
  • 全选,反选,获取值ajax提交

    //必须先加载jquery

    //加载 弹出框插件 artdialog          http://www.planeart.cn/demo/artDialog/

    /****全选反选*开始**/

     $(document).ready(function(){   
      $("input[name=checked_all]").click(function(){        
         var check_status = $(this).attr('checked');     
         if(check_status == "checked"){
           $(".single_status").attr("checked","checked");
         }
         if(check_status == undefined){
           $(".single_status").removeAttr("checked");
         }
       }) 
     });

    /****全选反选*结束**/

     function export_checked_tmp(){              
       var checked_tmp =$("input[name='export[]'][checked]");      //获取选中的值  开始
       var tmp_arr = new Array();
       $.each(checked_tmp,function(i,n){
        tmp_arr[i] = n.value
         //alert(n.value)
       })  

      if(tmp_arr.length==0){                      //如果有选中的值,提示信息
           art.dialog({
              time: 2,
              content: "请选择分配词条"
           });
         return false;        
       }

                            
      var dialog = art.dialog({id: 'N3690',title:false});          //获取完之后,ajax传参
      $.ajax({
           type: "post",
           url: "<?php echo base_url('index.php/task/create')?>",
           data: {'foo':tmp_arr,"type":"inve"},
           success: function(msg){
             dialog.content(msg);
           }
        });    
     }

    <input type="checkbox" class="fl" style="margin:8px" name="checked_all" />

    <input name="export[]" type ="checkbox" value="" class="single_status"> 

    <input name="export[]" type ="checkbox" value="" class="single_status"> 

  • 相关阅读:
    运行top时,会报unknown terminal type错误
    CSS 学习笔记
    HTML学习笔记
    在window平台搭建Qt开发环境(使用VS2008 IDE)
    GNU的ar,ranlib和nm
    GifCam
    linux modprobe命令参数及用法详解--linux加载模块命令
    如何制作gif动画,丰富自己的博客?
    来自 Github 的图形化 Git 使用教程
    idea创建maven-archetype-webapp项目无java目录
  • 原文地址:https://www.cnblogs.com/zhaoyang-1989/p/3490766.html
Copyright © 2011-2022 走看看