欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery綁定事件-多種實(shí)現(xiàn)方式總結(jié)

 更新時(shí)間:2016年05月09日 16:27:50   投稿:jingxian  
下面小編就為大家?guī)?lái)一篇jQuery綁定事件-多種實(shí)現(xiàn)方式總結(jié)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考

jQuery綁定事件-多種實(shí)現(xiàn)方式總結(jié)

<html>
<head>
<meta charset="utf-8" />
<script src=https://pan.baidu.com/s/1o8GiuOq?qq-pf-to=pcqq.c2c></script>
</head>

<body>
<input type="text"/>
<input type="button" value="button1"/>
<script>
$(function(){
  var text = $(":text");
  var button = $(":button");
  //調(diào)試器記錄日志 console.log("message"); 如:火狐瀏覽器,打開(kāi)FireBug(按F12)
  
  //觸發(fā)單個(gè)事件:兩種方式
  button.bind("mouseover",function(){
    console.log("移入");
  });
  button.bind({
    "mouseout": function(){
      console.log("移出");
    }
  });
  //多個(gè)事件:三個(gè)方式
  text.bind("dblclick blur",function(){
    console.log("雙擊或者失去焦點(diǎn)");
  });
  text.bind({
    "dblclick blur":function(){
      console.log("雙擊或者失去焦點(diǎn)");
    }
  });
  text.bind({
    "dblclick":function(){
      console.log("雙擊");
    },
    blur:function(){
      console.log("失去焦點(diǎn)");
    }
  });
  
  //取消事件
  text.unbind("dblclick"); //取消單個(gè)事件
  //text.unbind("dblclick blur"); //取消多個(gè)事件
  //text.unbind(); //取消全部事件
});

</script>
</body>
</html>

以上這篇jQuery綁定事件-多種實(shí)現(xiàn)方式總結(jié)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論