成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

jQuery Event Menthods

khlbat / 2597人閱讀

Here are some common DOM events

1 Mouser Events

click dbclick mouseenter mouseleave

2 Keyborars Events

keypress keydown keyup

3 Form Events

submit change focus blus

4 Docment/Wiindow Events

laod resize scroll unload

click()
the function is executed when the user clicks on the html element.
eg:

 $("p").click(function(){
    $(this).hide();
})

dblclick()

the dblclick() method attaches an event handlerfunction to an html element. the function is executed when the user double-clicks on the html element

eg:

 $("p").dblclick(function(){
    $(this).hide();
})

mouseenter()
the function is executed when the mouse pointer the html element
eg:

 $("p").mouseenter(function(){
    alert("you entered p");
})

mouseleave()

the function is executed when the mouse pointer leaves the html element

eg:

    $("#p").mouseleave(function(){
    alert("bye! you now leave p");
    })

mousedown()
the function is executed , when the left,middle or right button is pressed down, while the mouse is over the html element
eg:

 $("p").mousedown(function(){
    alert("mouse down over p");
})

mouseup()

the function is excuted, when the left.miffffdle or right mouse button is released while the nouse is over the html element
eg:

$("p").mouseup(function(){
alert("mouse up over p");
})

hover()
the hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods
the first function is executed when the mouse enters enters the html element, and the second function is executed when the mouse leaves the html element

eg:

$("p").hover(function(){
alert("you entered p");
},funtion(){
alert("bye! you now leave p");
})

focus()
the focus() methods attaches an event handler function to an html form the function is executed when the form field gets focus

eg:

$("input").focus(function(){
$(this).css("background-color","#cccccc");
});

blur()
the blur() method attaches an eveent handler function to an html
the function is executed when the form field loses focus

$("input").blur(function(){
$(this).css("background-color","#ffffff");
})

on()
the function attaches one or more event handlers for selected selected
elements
eg:

$("p").on("click",function(){
$(this).hide();
})

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/86896.html

相關(guān)文章

  • jQuery源碼解析之jQuery.event.dispatch()

    摘要:一起源方法最終是用綁定事件的而方法正是等于二作用觸發(fā)綁定的事件的處理程序源碼源碼行即原生觸發(fā)事件的處理程序修正對象獲取事件的處理程序集合,結(jié)構(gòu)如下從數(shù)據(jù)緩存中獲取事件處理集合即目標元素委托目標這段代碼壓根不會執(zhí)行,因為全局搜索沒找到結(jié)構(gòu) showImg(https://segmentfault.com/img/remote/1460000019464031); 一、起源jQuery.e...

    GraphQuery 評論0 收藏0
  • jQuery 源碼系列(十三)事件處理源碼

    摘要:專門為事件建立一個有問題,直接退出如果是一個事件處理對象,且有屬性。參考源碼分析事件體系結(jié)構(gòu)解密事件核心綁定設(shè)計一解密事件核心委托設(shè)計二本文在上的源碼地址,歡迎來。 歡迎來我的專欄查看系列文章。 通過前面一章對于 addEvent 庫的介紹,它的兼容性超級棒,據(jù)說對于 IE4、5 都有很好的兼容性,這和 jQuery 的原理是一致的,而在 jQuery 中,有一個對象與其相對應(yīng),那就是...

    劉厚水 評論0 收藏0
  • jQuery 源碼系列(十四)自定義事件

    摘要:不過也有自己的一套自定義事件方案??梢院褪录脕韺Ρ龋麄兌际怯脕砟M和執(zhí)行監(jiān)聽的事件。冒泡事件就是就是由內(nèi)向外冒泡的過程,這個過程不是很復(fù)雜。參考解密事件核心自定義設(shè)計三解密事件核心模擬事件四本文在上的源碼地址,歡迎來。 歡迎來我的專欄查看系列文章。 以前,我只知道,只有當對瀏覽器中的元素進行點擊的時候,才會出發(fā) click 事件,其它的事件也一樣,需要人為的鼠標操作。 showIm...

    elliott_hu 評論0 收藏0
  • jQuery源碼學習之event

    摘要:回調(diào)隊列中的元素是對象,代表一個事件回調(diào),擁有多個屬性,如等等,其中是回調(diào)函數(shù),在觸發(fā)時通過傳遞,具體的在后面講。類型是時鍵表示事件名,規(guī)則同上,鍵值表示事件觸發(fā)時的回調(diào)函數(shù)。 jQuery源碼學習之event jQuery的事件機制為異步回調(diào),事件監(jiān)聽的屬性、參數(shù)和回調(diào)的等保存在Data實例中,在元素上保存該對象的引用。有方法handle,內(nèi)部執(zhí)行dispatch;有屬性events...

    XboxYan 評論0 收藏0

發(fā)表評論

0條評論

khlbat

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<