【转】各种 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