事件
blur()
触发每一个匹配元素的blur事件。
这个函数会调用执行绑定到blur事件的所有函数,包括浏览器的默认行为。可以通过返回false来防止触发浏览器的默认行为。blur事件会在元素失去焦点的时候触发,既可以是鼠标行为,也可以是按tab键离开的
--------------------------------------------------------------------------------
Triggers the blur event of each matched element.
This causes all of the functions that have been bound to that blur event to be executed, and calls the browser's default blur action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the blur event. The blur event usually fires when an element loses focus either via the pointing device or by tabbing navigation
返回值
jQuery
示例
触发所有段落的blur事件
jQuery 代码:
$("p").blur();
blur(fn)
在每一个匹配元素的blur事件中绑定一个处理函数。
blur事件会在元素失去焦点的时候触发,既可以是鼠标行为,也可以是按tab键离开的
--------------------------------------------------------------------------------
Bind a function to the blur event of each matched element.
The blur event fires when an element loses focus either via the pointing device or by tabbing navigation.
返回值
jQuery
参数
fn (Function) : 在每一个匹配元素的blur事件中绑定的处理函数。
示例
任何段落失去焦点时弹出一个 "Hello World!"在每一个匹配元素的blur事件中绑定的处理函数。
jQuery 代码:
$("p").blur( function () { alert("Hello World!"); } );
change()
触发每个匹配元素的change事件
这个函数会调用执行绑定到change事件的所有函数,包括浏览器的默认行为。可以通过在某个绑定的函数中返回false来防止触发浏览器的默认行为。change事件会在元素失去焦点的时候触发,也会当其值在获得焦点后改变时触发。
--------------------------------------------------------------------------------
Triggers the change event of each matched element.
This causes all of the functions that have been bound to that change event to be executed, and calls the browser's default change action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the change event. The change event usually fires when a control loses the input focus and its value has been modified since gaining focus.
返回值
jQuery
change(fn)
在每一个匹配元素的change事件中绑定一个处理函数。
change事件会在元素失去焦点的时候触发,也会当其值在获得焦点后改变时触发。
--------------------------------------------------------------------------------
Binds a function to the change event of each matched element.
The change event fires when a control loses the input focus and its value has been modified since gaining focus.
返回值
jQuery
参数
fn (Function) : 在每一个匹配元素的change事件中绑定的处理函数。
示例
给所有的文本框增加输入验证
jQuery 代码:
$("input[type='text']").change( function() {
// 这里可以写些验证代码
});
click()
触发每一个匹配元素的click事件。
这个函数会调用执行绑定到click事件的所有函数。
--------------------------------------------------------------------------------
Triggers the click event of each matched element.
Causes all of the functions that have been bound to that click event to be executed.
返回值
jQuery
示例
触发页面内所有段落的点击事件
jQuery 代码:
$("p").click();
click(fn)
在每一个匹配元素的click事件中绑定一个处理函数。
点击事件会在你的指针设备的按钮在元素上单击时触发。单击的定义是在屏幕的同一点触发了mousedown和mouseup.几个事件触发的顺序是:
mousedown
mouseup
click
--------------------------------------------------------------------------------
Binds a function to the click event of each matched element.
The click event fires when the pointing device button is clicked over an element. A click is defined as a mousedown and mouseup over the same screen location. The sequence of these events is:
mousedown
mouseup
click
返回值
jQuery
参数
fn (Function) : 绑定到click事件的函数
示例
将页面内所有段落点击后隐藏。
jQuery 代码:
$("p").click( function () { $(this).hide(); });
dblclick()
触发每一个匹配元素的dbclick事件。
这个函数会调用执行绑定到dblclick事件的所有函数,包括浏览器的默认行为。可以通过在某个绑定的函数中返回false来防止触发浏览器的默认行为。dblclick事件会在元素的同一点双击时触发。
--------------------------------------------------------------------------------
Triggers the dblclick event of each matched element.
This causes all of the functions that have been bound to that dblclick event to be executed, and calls the browser's default dblclick action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the dblclick event. The dblclick event usually fires when the pointing device button is double clicked over an element.
返回值
jQuery
dblclick(fn)
在每一个匹配元素的dblclick事件中绑定一个处理函数。
的那个在某个元素上双击的时候就会触发dblclick事件
--------------------------------------------------------------------------------
Binds a function to the dblclick event of each matched element.
The dblclick event fires when the pointing device button is double clicked over an element
返回值
jQuery
参数
fn (Function) : 在每一个匹配元素的dblclick事件中绑定的处理函数。
示例
给页面上每个段落的双击事件绑上 "Hello World!" 警告框
jQuery 代码:
$("p").dblclick( function () { alert("Hello World!"); });
error()
这个函数会调用执行绑定到error事件的所有函数,包括浏览器的默认行为。可以通过在某个绑定的函数中返回false来防止触发浏览器的默认行为。
--------------------------------------------------------------------------------
Triggers the error event of each matched element.
This causes all of the functions that have been bound to that error event to be executed, and calls the browser's default error action on the matching element(s). This default action can be prevented by returning false from one of the functions bound to the error event. The error event usually fires when an element loses focus either via the pointing device or by tabbing navigation.
返回值
jQuery
error(fn)
在每一个匹配元素的error事件中绑定一个处理函数。
对于error事件,没有一个公众的标准。在大多数浏览器中,当页面的JavaScript发生错误时,window对象会触发error事件;当图像的src属性无效时,比如文件不存在或者图像数据错误时,也会触发图像对象的error事件。
如果异常是由window对象抛出,事件处理函数将会被传入三个参数:
1. 描述事件的信息 ("varName is not defined", "missing operator in expression", 等等.),
2. 包含错误的文档的完整URL
3. 异常发生的行数
如果事件处理函数返回true,则表示事件已经被处理,浏览器将认为没有异常。
更多相关信息:
msdn - onerror Event
Gecko DOM Reference - onerror Event
Gecko DOM Reference - Event object
Wikipedia: DOM Events
--------------------------------------------------------------------------------
Binds a function to the error event of each matched element.
There is no public standard for the error event. In most browsers, the window object's error event is triggered when a JavaScript error occurs on the page. An image object's error event is triggered when it is set an invalid src attribute - either a non-existent file, or one with corrupt image data.
If the event is thrown by the window object, the event handler will be passed three parameters:
1. A message describing the event ("varName is not defined", "missing operator in expression", etc.),
2. the full URL of the document containing the error, and
3. the line number on which the error occured.
If the event handler returns true, it signifies that the event was handled, and the browser raises no errors.
For more information, see:
msdn - onerror Event
Gecko DOM Reference - onerror Event
Gecko DOM Reference - Event object
Wikipedia: DOM Events
返回值
jQuery
参数
fn (Function) :在每一个匹配元素的error事件中绑定的处理函数。
示例
在服务器端记录JavaScript错误日志:
jQuery 代码:
$(window).error(function(msg, url, line){
jQuery.post("js_error_log.php", { msg: msg, url: url, line: line });
});
----------------------
jquery文本,以文本格式保存的jquery文件
4星 · 超过85%的资源 需积分: 44 57 浏览量
2010-01-06
15:24:43
上传
评论
收藏 44KB RAR 举报
zmsite
- 粉丝: 2
- 资源: 7
最新资源
- 办工,日常生活中电脑中的磁盘清理功能,可以查找本机的指定大小文件,非常方便!
- cuda-使用cuda并行加速实现之gemv.zip
- cuda-使用cuda并行加速实现之softmax.zip
- 基于Opencv的车牌识别系统
- cuda-使用cuda并行加速实现之reduce.zip
- 基于Protel 99se 超级元件库电子器件芯片库原理图库2MB(810个)+PCB封装库10MB(1240个)合集.zip
- mmexport1713919112597.jpg
- cuda-使用cuda并行加速实现之kmeans聚类算法的实现.zip
- web-work-2024-4-24
- cuda-使用cuda并行加速实现之UpsampleNearest2D.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页