亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery ?? ??? ??

???? ??? ??


dom1 ?? ??? ??

  • <input type=”text” onclick=”?? ??” value='tom' / > ;

  • <input type="text" onclick="function()" />

  • itnode.onclick = function(){}

  • itnode.onclick = function;


dom ?? 2 ??? ??

  • itnode.addEventListener(??, ??, ??? ??);

  • itnode.removeEventListener(??, ??, ??? ??);

  • node.attachEvent();

  • node.detachEvent();


jquery ??? ??

  • $().??? ??(??? ?? ??fn ) / /??? ??

  • $().Event type(); //??? ?? ??

  • ??? ??: ??, ??, ???, ?????, ?????, ??, ??? ?

  • ?? ?? : $('div').click(function(){??? ??? ???? this});

??: ??? ?? ?? ? ???? jquery ?? ?? dom ?? ??? ?????.

<!DOCTYPE html>
<html>
    <head>
        <title>php.cn</title>
        <meta charset="utf-8" />
        <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
        <script>
        $(function(){
            //頁(yè)面加載完畢給div綁定事件
            $('div').click(function(){
                console.log('誰在碰我呢');
            });
            //$('li').each(function(){
                //this關(guān)鍵字分別代表每個(gè)li的dom對(duì)象
                //jquery使用時(shí),代碼結(jié)構(gòu)類似這樣的,this都代表dom對(duì)象
            //});
            $('div').mouseover(function(){
                //this.style.backgroundColor = "blue";
                //$(this)使得this的dom對(duì)象變?yōu)閖query對(duì)象
                $(this).css('background-color','red');
            });
        });
        function f1(){
            //間接觸發(fā)對(duì)象的事件執(zhí)行
            $('div').click(); //使得div的單擊事件執(zhí)行
            $('div').mouseover();  //鼠標(biāo)移入事件執(zhí)行
        }
        </script>
        <style type="text/css">
        div {width:300px; height:200px; background-color:pink;}
        </style>
    </head>
    <body>
        <div></div>
        <input type="button" value="間接操作" onclick="f1()" />
    </body>
</html>
???? ??
||
<!DOCTYPE html> <html> <head> <title>php.cn</title> <meta charset="utf-8" /> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> $(function(){ //頁(yè)面加載完畢給div綁定事件 $('div').click(function(){ console.log('誰在碰我呢'); }); //$('li').each(function(){ //this關(guān)鍵字分別代表每個(gè)li的dom對(duì)象 //jquery使用時(shí),代碼結(jié)構(gòu)類似這樣的,this都代表dom對(duì)象 //}); $('div').mouseover(function(){ //this.style.backgroundColor = "blue"; //$(this)使得this的dom對(duì)象變?yōu)閖query對(duì)象 $(this).css('background-color','red'); }); }); function f1(){ //間接觸發(fā)對(duì)象的事件執(zhí)行 $('div').click(); //使得div的單擊事件執(zhí)行 $('div').mouseover(); //鼠標(biāo)移入事件執(zhí)行 } </script> <style type="text/css"> div {width:300px; height:200px; background-color:pink;} </style> </head> <body> <div></div> <input type="button" value="間接操作" onclick="f1()" /> </body> </html>