标签:style blog http java color strong
onmouseover 事件会在鼠标指针移动到指定的对象上时发生。
onmouseover="SomeJavaScriptCode"
参数 |
描述 |
---|---|
SomeJavaScriptCode |
必需。规定该事件发生时执行的 JavaScript。 |
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, <li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>
layer, link
在下面的例子中,我们将在用户把鼠标指针移动到图像上时显示一个对话框:
1 <img src="http://www.w3school.com.cn/i/eg_mouse2.jpg" alt="mouse" onmouseover="alert(‘您的鼠标在图片上!‘)" />
下面的例子中,我们将在网页上添加一个用作连接按钮的图像,然后我们会添加 onMouseOver 和 onMouseOut 事件,这样就可以在运行两个 JavaScript 函数来切换两幅图像:
1 <html> 2 <head> 3 <script type="text/javascript"> 4 function mouseOver() 5 { 6 document.getElementById(‘b1‘).src ="/i/eg_mouse.jpg" 7 } 8 function mouseOut() 9 { 10 document.getElementById(‘b1‘).src ="/i/eg_mouse2.jpg" 11 } 12 </script> 13 </head> 14 15 <body> 16 <a href="http://www.w3school.com.cn" 17 onmouseover="mouseOver()" onmouseout="mouseOut()"> 18 <img alt="Visit W3School!" src="/i/eg_mouse2.jpg" id="b1" /> 19 </a> 20 </body> 21 </html>
标签:style blog http java color strong
原文地址:http://www.cnblogs.com/gmblog/p/3826121.html