<html>

           <head>

                                <title>jQuery Tutorial Demo: Select All Checkboxes</title>

                                <script type="text/javascript" src="jquery.js"></script>

                                <style type="text/css">body{font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px}

                                h1, h2{font-size:20px;}</style>

           </head>

           <body>

                     <script type="text/javascript">

                     $(document).ready(function()

                     {

                                $("#paradigm_all").click(function()                                 

                                {

                                          var checked_status = this.checked;

                                          $("input[@name=paradigm]").each(function()

                                          {

                                                     this.checked = checked_status;

                                          });

                                });                                                  

                     });

                    

                     </script>

                     <a href="http://jetlogs.org/2007/07/01/jquery-select-all-checkbox/">&laquo; Code Explanation</a> | <a href="jquery_select_all.zip">Download Source</a>

                     <h2>jQuery Tutorial: Select All Checkbox</h2>

                     <p>Here is a very simple demonstration of how the select all checkbox is implemented in jQuery</p>

                    

                     Javascript supports the following programming paradigms:<br>

                     <input type="checkbox" name="paradigm" value="Imperative">Imperative<br>

                     <input type="checkbox" name="paradigm" value="Object-Oriented">Object-Oriented<br>

                     <input type="checkbox" name="paradigm" value="Functional">Functional<br><br>             

                     <input type="checkbox" id="paradigm_all">Select All<br>

 

                    

           </body>

</html>


 $(":input:radio[name=sample]:checked").val()
 
  <input type="radio" name ="sample" value="Y" checked>
  <input type="radio" name ="sample" value="N">


// Ajax 파일 다운로드
jQuery.download = function(url, data, method){
    // url
data를 입력받음
    if( url && data ){
        // data
  string 또는 array/object 를 파라미터로 받는다.
        data = typeof data == 'string' ? data : jQuery.param(data);
        //
파라미터를 form  input으로 만든다
.
        var inputs = '';
        jQuery.each(data.split('&'), function(){
            var pair = this.split('=');
            inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
        });
        // request
를 보낸다
.
        jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
        .appendTo('body').submit().remove();
    };
};

***
폼을 동적으로 그리고 submit한 후 폼을 remove한다.


실행예

$.download('testExcelDownload.do','find=commoncode','post' );

물런 data에 file명을 쓰는 현명한 행동을 하지 않길 바란다..

+ Recent posts