【转】各种 on事件触发js代码

1、onmouseenter:当鼠标进入选区执行代码

<div style="background-color:red" onmouseenter="alert('bem')">123456</div>
 
2、onmouseleave:当鼠标离开选区执行代码
<DIV onmouseleave="alert('bem')" style="BACKGROUND-COLOR: red">123456</DIV>
 
3、onmousewheel:当鼠标在选区滚轮时执行代码
<DIV onmousewheel="alert('bem')" style="BACKGROUND-COLOR: red">123456</DIV>
 
4、onscroll:拖动滚动条执行代码
<div style="width:100px;height:100px;overflow:scroll" onscroll="alert('bem')">123456</div>
 
5、onfocusin:当获得焦点时执行代码
<div contentEditable="true" style="background-color:red" onfocusin="alert('bem')" >asdf</div>
 
6、onfocusout:当失去焦点时执行代码
<div contentEditable="true" style="background-color:red" onfocusout="alert('bem')" >asdf</div>
 
7、onstart:当显示内容时执行代码
<marquee style="background-color:red" onstart="alert('bem')" >asdf</marquee>
 
8、onbeforecopy:选中内容后右键执行代码
<div style="background-color:red;" onbeforecopy="alert('bem')" >asdf</div>
 
9、onbeforecut:选中内容后右键执行代码
<div style="background-color:red;" onbeforecut="alert('bem')" >asdf</div>
 
10、onbeforeeditfocus:当获得焦点时执行代码
<div style="background-color:red;" contentEditable="true" onbeforeeditfocus="alert('bem')" >asdf</div>
 
11、onbeforepaste:选中内容后右键执行代码
<div style="background-color:red;" ="true" onbeforepaste="alert('bem')" >asdf</div>
 
12、oncontextmenu:鼠标右键执行代码
<div style="background-color:red;" oncontextmenu="alert('bem')" >asdf</div>
 
13、oncopy:鼠标右键执行复制时执行代码
<div style="background-color:red;" oncopy="alert('bem')" >asdf</div>
 
14、oncut:鼠标右键执行剪切时执行代码
<div contentEditable="true" style="background-color:red;" oncut="alert('bem')" >asdf</div>
 
15、ondrag:选择内容并拖动时执行代码
<div style="background-color:red;" ondrag="alert('bem')" >asdf</div>
 
16、ondragend:选择内容并拖动松开鼠标执行代码
<div style="background-color:red;" ondragend="alert('bem')" >asdf</div>
 
17、ondragenter:选择内容并拖动时执行代码
<div style="background-color:red;" ondragenter="alert('bem')" >asdf</div>
 
18、ondragleave:选择内容并拖出边框执行代码
<div contentEditable="true" style="background-color:red;" ondragleave="alert('bem')" >asdf</div>
 
19、ondragover:选择内容并拖动时执行代码
<div contentEditable="true" style="background-color:red;" ondragover="alert('bem')" >asdf</div>
 
20、ondragstart:选择内容并拖动时执行代码
<div contentEditable="true" style="background-color:red;" ondragstart="alert('bem')" >asdf</div>
 
21、ondrop:有内容被拖动进来时执行代码
<div contentEditable="true" style="background-color:red;" ondrop="alert('bem')" >asdf</div>
<div contentEditable="true" style="background-color:green;" ondrop="alert('bem')" >asdf</div>
 
22、onlosecapture:选择内容时执行代码
<div contentEditable="true" style="background-color:red;" onlosecapture="alert('bem')" >asdf</div>
 
23、onpaste:粘贴时执行代码
<div contentEditable="true" style="background-color:red;" onpaste="alert('bem')" >asdf</div>
 
24、onselectstart:选择内容时执行代码
<div contentEditable="true" style="background-color:red;" onselectstart="alert('bem')" >asdf</div>
 
25、onhelp:进入焦点按F1时执行代码
<div contentEditable="true" style="background-color:red;" onhelp="alert('bem')" >asdf</div>
 
26、onEnd:当时间线执行完毕时执行代码
<div STYLE="background-color:red;behavior:url('#default#time2')" onEnd="alert('bem')">asdf</div>
 
27、onBegin:当时间线开始执行代码
<div STYLE="background-color:red;behavior:url('#default#time2')" onBegin="alert('bem')">asdf</div>
 
28、onactivate:激活当前标签时执行代码
<div contentEditable="true" STYLE="background-color:red;" onactivate="alert('bem')">asdf</div>
 
29、onfilterchange:当滤镜改变时执行代码
<div contentEditable="true" STYLE="background-color:red;filter: Alpha(opacity=100, style=2);" onfilterchange="alert('bem')">asdf</div>
 
30、onbeforeactivate:当激活当前标签时执行代码
<div contentEditable="true" STYLE="background-color:red;" onbeforeactivate="alert('bem')">asdf</div>
 
31、onbeforedeactivate:当标签内值改变时执行代码
<div contentEditable="true" STYLE="background-color:red;" onbeforedeactivate="alert('bem')">asdf</div>
 
32、ondeactivate:当标签内值改变时执行代码
<div contentEditable="true" STYLE="background-color:red;" ondeactivate="alert('bem')">asdf</div>

原文转自:http://hi.baidu.com/anky27/item/ead867e06373c80265db0061

各种 on事件触发js代码的更多相关文章

  1. 如何查找元素对应事件的js代码,检测定位js事件

    比如一张图片当鼠标放到上面时,图片改变.想找到这个事件对应的js代码,假设另存为html之后,文件夹中有.js文件. 如果你会调试,可以用打开浏览器的调试功能,以chrome为例,按F12打开调试窗口 ...

  2. js 如何判断鼠标点击事件还是js代码调用

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  3. 如何查找元素对应事件的js代码

    以chrome的firebug为例 1.找到其dom元素,然后右键"break on"-->"subtree modification"等,设置后元素旁边 ...

  4. 使用浏览器,调试js代码

    1:创建html网页和js文件 <!doctype html> <html> <head> <meta charset="utf-8"&g ...

  5. 关于JS 事件冒泡和onclick,click,on()事件触发顺序

    今天在给JQgrid中的标签添加click事件的时候,发现一个问题. JQgrid的table中,点击任何位置,都会勾选点击行的checkbox,而我希望在点击我的标签的时候,不要勾选checkbox ...

  6. js事件触发(一)

    今日和一位前端童鞋聊了下js触发事件的两种形式: 第一种在jsp/vm上做类似onClick=functionName()的触发:另一种是在js文件中增加对应节点的监听事件触发.前者页面掺杂了js的内 ...

  7. js进阶 12-14 jquery的事件触发函数是哪两个

    js进阶 12-14 jquery的事件触发函数是哪两个 一.总结 一句话总结:trigger和triggerHandler 1.trigger传额外参数时候的注意事项是什么? 注意样例中是三个参数 ...

  8. JS事件调试 - 查找HTML元素绑定的事件以及绑定代码所在位置

    日常的网页开发调试工作中,经常需要知道指定的某个网页元素绑定了哪些事件以及绑定代码的位置,下面介绍三种用来跟踪页面中的事件的方法. 1.使用firefox调试 我们可以使用firefox的debug工 ...

  9. JS代码的位置与事件响应代码块的封装问题

    JS代码的位置       我们可以将JavaScript代码放在html文件中任何位置,但是我们一般放在网页的head或者body部分.   放在<head>部分最常用的方式是在页面中h ...

随机推荐

  1. Vue组成和第3方插件

    vue全家桶的成员是:vue-cli,vuex,vue-router,vue-axios(vue2.0). 第三方插件:vue-scroller,vue-lazyload,vue-awesome-sw ...

  2. for 与 for in

    在JavaScript中提供了两种方式迭代对象: (1)for 循环: (2)for..in循环: 使用for循环进行迭代数组对象,想必大家都已经司空见惯了.但是,使用for.. in循环时,大家可要 ...

  3. verilog之inout

    1.inout 类型的data信号 写操作有效时(rd_wr_l=0):data端口输入信号,此时data为高阻态,允许对其进行赋值. 读操作有效时(rd_wr_l=1):data端口输出信号,此时d ...

  4. Python3 round() 函数

    Python3 round() 函数  Python3 数字 描述 round() 方法返回浮点数x的四舍五入值. 语法 以下是 round() 方法的语法: round( x [, n] ) 参数 ...

  5. TOJ 4383 n % ( pow( p , 2) ) ===0

    传送门:http://acm.tzc.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=4383 描述 There is a ...

  6. 装了appserv之后,浏览器中访问localhost加载不了

    AppServe下载地址:https://AppServnetwork.com/ 如果只下载Apache,推荐大神博客http://www.cnblogs.com/zhaoqingqing/p/496 ...

  7. C++ 智能指针shared_ptr的实现

    #include <memory> #include <iostream> using namespace std; template<typename T> cl ...

  8. day 22 反射,双下方法

    反射: 反射:通过字符串去操作对象(类,空间等等)的属性或方法反射的四个方法 hasattr *** getattr *** setattr *** delattr *** # getattr 用法c ...

  9. WorkerMan源码分析(resetStd方法,PHP中STDIN, STDOUT, STDERR的重定向)

    WorkerMan中work.php中 resetStd 方法中代码如下 public static function resetStd() { if (!static::$daemonize || ...

  10. Django日志系统

    在Django中使用的日志系统是基于Python中的loggin模块. 首先简单介绍下logging. 一 Loggin模块简介 loggin模块主要包含以下四个部分: Loggers        ...