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

jquery事件函數(shù)實現(xiàn)

Original 2018-10-31 15:10:45 220
abstract:<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>jquery的事件函數(shù)</title>    <script type=&

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>jquery的事件函數(shù)</title>
   <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
</head>
<body>
<script>
// 在jquery中是以調(diào)用事件函數(shù)的方式來觸發(fā)事件的,如js中的onclick事件,在jquery中用click()來替代
//簡單的理解:事件方法會觸發(fā)匹配元素的事件,或者將函數(shù)綁定到所有匹配元素的某個事件
// ready() 當(dāng)文檔對象模型加載完成,觸發(fā)事件==js的onload
  //不可以與<body onload="">一起使用
//  $(document).ready(function(){
  //
  //  })
   //blur()當(dāng)失去焦點時觸發(fā)==onblur
  //change()當(dāng)元素的值發(fā)生改變
//click()點擊事件
$(document).ready(function(){
      //  $('input').blur(function(){
      //      $('input').css('background','red')
      //  })
      // $('input').focus(function(){
      //     $('input').css('background','blue')
      // })
      // $('input').change(function(){
      //     $('input').css('background','pink')
      // })
      //  $('button').click(function(){
      //     $('div').css('background','pink')
      // })
      // $('div').dblclick(function(){
      //     $(this).css('background','pink')
      // })
      //     $(document).mousemove(function (aa) {
      //         $('span').text('x: '+aa.pageX+'y: '+aa.pageY)
      //     })
      // a=0;
      // $(window).resize(function(){
      //     //alert('窗口被調(diào)整大小')
      //     $('b').text(a++)
      // })
      // $('div').mouseover(function(){
      //     $(this).css('background','pink')
      // })
      // $('div').mouseenter(function(){
      //     $(this).css('background','pink')
      // })
      // $('div').mouseleave(function(){
      //     $(this).css('background','blue')
      // })
      // $('div').mouseout(function(){
      //     $(this).css('width','50px')
      // })
      // $('div').mousedown(function(){
      //     $(this).css('width','50px')
      // })
$('div').mouseup(function(){
          $(this).css('width','50px')
      })
  })
</script>
<input type="text" name="">
<!--<div style="width:100px;height:100px;background: red;margin-top: 20px;"></div>-->
<!--<button>點擊</button>-->
<!--<div>-->
   <!--當(dāng)前鼠標(biāo)的位置:<span></span>-->
<!--</div>-->
<!--<div>-->
   <!--頁面被調(diào)整次數(shù):<b></b>-->
<!--</div>-->
<div style="width:100px;height:100px;background: red;">測試</div>
</body>
</html>

理解:類似于js中的事件,只是寫法不同,比js方便

Release Notes

Popular Entries