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>