語法
onmouseover="SomeJavaScriptCode"
標籤
<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>
事件對象
link,layer
onmouseover與onmousemove的區別
時間上,onmousemove事件觸發後再觸發onmouseover事件;動作上,onmouseover只在剛進入區域時觸發。onmousemove除了剛進入區域時觸發外,在區域內移動滑鼠也會觸發。
參數
onmousemove事件的參數如下所示:
參數 | 描述 |
SomeJavaScriptCode | 必需。規定該事件發生時執行的 JavaScript。 |
實例
<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.getElementById('b1').src ="/i/eg_mouse.jpg"
}
function mouseOut()
{
document.getElementById('b1').src ="/i/eg_mouse2.jpg"
}
</script>
</head>
<body>
<a href="http://www.w3school.com.cn"
onmouseover="mouseOver()" onmouseout="mouseOut()">
<img alt="Visit W3School!" src="/i/eg_mouse2.jpg" id="b1" />
</a>
</body>
</html>