ÍøÂçѧԺ

w3pop.com :: ÍøÂçѧԺ :: JavaScript :: JavaScript onmouseout ʼþ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

JavaScript onmouseout ʼþ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:18631 :: ::

Definition and Usage
¶¨ÒåÓëÓï·¨

The onmouseout event occurs when the mouse pointer moves away from a specified object.
µ±Êó±ê´ÓÌØ¶¨µÄ¶ÔÏóÉÏÒÆ¿ªÊ±´¥·¢onmouseoutʼþ

Syntax
Óï·¨

onmouseout="ËùÒªÖ´ÐеĽű¾"

Parameter
²ÎÊý
Description
×¢ÊÍ
SomeJavaScriptCode
×öÒªÖ´ÐеĽű¾
Required. Specifies a JavaScript to be executed when the event occurs.
±ØÑ¡Ïî¡£µ±Ê¼þ´¥·¢Ê±ËùÒªÖ´ÐеĽű¾

Supported by the following HTML tags:
ËùÖ§³ÖµÄHTML±êÇ©£º

<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>

Supported by the following JavaScript objects:
ËùÖ§³ÖµÄJavaScript¶ÔÏó£º

layer, link


Example 1
ʵÀý1

In the following example we will display an alert box when the user moves the mouse pointer away from the image:
ÔÚÏÂÃæµÄÀý×ÓÖУ¬µ±Óû§µÄÊó±ê´ÓͼƬÉÏÒÆ¿ªÊ±½«»áµ¯³öÒ»¸öÏûÏ¢¿ò£º

<img src="image_w3default.gif" alt="W3POP"
onmouseout="alert('W3POP!')" />

The output of the code above will be:
ÉÏÊö´úÂëµÄÊä³ö½á¹ûΪ£º

W3POP


Example 2
ʵÀý2

In the following example we will add an image that should act as a link button on a web page. We will then add an onMouseOver event and an onMouseOut event that will run two JavaScript functions that will change between two images:
ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÎÒÃÇÊ×ÏȼÓÈëÒ»ÕÅͼƬ×÷ΪÁ´½Ó¡£½Ó×ÅÎÒÃÇÏëÆä¼ÓÈëonMouseOverºÍonMouserOutʼþ£¬Ê¹ÆäÄܹ»ÔÚÁ½ÕÅͼƬ¼äÇл»£º

<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.b1.src ="b_blue.gif"
}
function mouseOut()
{
document.b1.src ="b_pink.gif"
}
</script>
</head>
<body>
<a href="http://www.w3POP.com" target="_blank"
onmouseover="mouseOver()"
onmouseout="mouseOut()">
<img border="0" alt="W3POP!"
src="b_pink.gif" name="b1" /></a>
</body>
</html>

The output of the code above will be:
ÉÏÊö´úÂëµÄÊä³ö½á¹ûΪ£º

W3POP!


Try-It-Yourself Demos
»¥¶¯ÑÝʾ

onmouseout
How to use onmouseout.
ÈçºÎÓ¦ÓÃonmouseout

ÆÀÂÛ (0) All