2014-01-17 81 views

回答

0

若要当鼠标停留在图像显示,但然后隐藏在不鼠标滑过:

<html> 
<head> 
<script type="text/javascript"> 
function showIt(imgsrc) 
{ 
document.getElementById('imageshow').src=imgsrc; 
document.getElementById('imageshow').style.display='block'; 
} 

function hideIt() 
{ 
document.getElementById('imageshow').style.display='none'; 
} 
</script> 
</head> 
<body> 
<img src="image1.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"><br> 
<img src="image2.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"> 
<br> 
<br> 
<br> 
<img src="" id="imageshow" style="display:none"> 
</body> 
</html> 

有它显示的默认图像,即使你没有鼠标悬停在某图像,但随后显示的图像,如果你将鼠标悬停在它:

<html> 
<head> 
<script type="text/javascript"> 
function showIt(imgsrc) 
{ 
document.getElementById('imageshow').src=imgsrc; 
} 

function hideIt() 
{ 
document.getElementById('imageshow').src="default.jpg"; 
} 
</script> 
</head> 
<body> 
<img src="image1.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"><br> 
<img src="image2.jpg" onmouseover="showIt(this.src)" onmouseout="hideIt()"> 
<br> 
<br> 
<br> 
<img src="default.jpg" id="imageshow"> 
</body> 
</html> 

有它显示一个图像,当鼠标悬停你,然后继续显示甚至WH最后的图像带你鼠标移开它:

<html> 
<head> 
<script type="text/javascript"> 
function showIt(imgsrc) 
{ 
document.getElementById('imageshow').src=imgsrc; 
} 
</script> 
</head> 
<body> 
<img src="image1.jpg" onmouseover="showIt(this.src)"><br> 
<img src="image2.jpg" onmouseover="showIt(this.src)"> 
<br> 
<br> 
<br> 
<img src="default.jpg" id="imageshow"> 
</body> 
</html> 

希望这有助于..

+0

我想显示图像的基团,与相邻的实际图像的弹出和隐藏弹出时,鼠标移出。我不想使用任何Div。 – Sheeraz

相关问题