Mouseover display layer: mouseout hidden layer. When you move the cursor over the upper layer, the layer is displayed. [original]

Source: Internet
Author: User

Last night, I had a project requirement. Now I need to put the mouse on the link and show the layer. After I leave the link, I can hide the layer. The trouble is that when I move the mouse over the upper layer, this layer will always show, leave this layer and hide it again. At noon today, we haven't arrived at work. We tested it briefly and succeeded. The detailed principle will not be detailed. Please refer to the source code:

 

JS-code

 

<Body>
<A href = "javascript: voie (0)" id = "atest" onmouseover = "a_onmouseover ()"> put the mouse over the test </a>
<Div id = "divtest" style = "display: none; Background: red; width: 100px">
I have shown it !!!
</Div>

<SCRIPT type = "text/JavaScript">
/*
* Data: 2009/12/11
* Author: Dong Guangxiang
*/

VaR timer;
Function a_onmouseover ()
{
VaR DDV = Document. getelementbyid ("divtest ");
VaR atest = Document. getelementbyid ("atest ");
DDV. style. Display = "Block ";
DDV. onmouseover = function (){
Cleartimeout (timer );
DDV. onmouseout = function (){
This. style. Display = "NONE ";
}
}
Atest. onmouseout = function () {mout ()}
}

Function mout ()
{
Timer = setTimeout (function () {document. getelementbyid ("divtest"). style. Display = "NONE";}, 100 );
}

</SCRIPT>

</Body>

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.