问题描述
firends,
i hav写了以下代码,用于更改鼠标悬停事件中的图像源。
它在Chrome和mozilla中工作正常,但在IE中无效。
---------------------------------------------- -----------------------------------------
img src =images / - col --- fix-12.pngid =img2onmouseover =img2.src =''images / 1234.png''; onmouseout =img2.src =''images / - col --- fix-12.png'';
------------------------------------------ --------------------------------------------------
请整理出来。
提前预定
firends,
i hav written following code for changing image source on mouseover event .
its working fine in chrome and mozilla bt not working in IE.
---------------------------------------------------------------------------------------
img src="images/--col---fix-12.png" id="img2" onmouseover="img2.src=''images/1234.png'';" onmouseout=" img2.src=''images/--col---fix-12.png'';"
--------------------------------------------------------------------------------------------
please sort it out.
thanx in advance
推荐答案
<img src="images/--col---fix-12.png" id="img2" onmouseover="SecondImage();" onmouseout="OriginalImage();">
function SecondImage()
{
document.getElementById('img2').src = 'images/1234.png';
}
function OriginalImage()
{
document.getElementById('img2').src = 'images/--col---fix-12.png';
}
这篇关于在鼠标悬停事件中更改图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!