jQuery中bind方法传参

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head>  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <title>Simple JQuery</title>  
    <mce:script type="text/javascript" src="js/jquery.js" mce_src="js/jquery.js"></mce:script>  
    <mce:script type="text/javascript"><!--  
     $(function(){  
     $('#mybtn').bind('click', {a : 'hello', b : 'world'}, myFun);  
     });  
       
     function myFun(e) {  
      alert(e.data.a);  
     alert(e.data.b)  
     }  
    // --></mce:script>  
    </head>  
    <body>  
    <input type="button" id="mybtn" value="Click me." />  
    </body>  
    </html>  

 

posted @ 2013-03-22 11:34  baiezone  阅读(362)  评论(0编辑  收藏  举报