我有一个由 JavaScript 制成的横幅,其中当您悬停特定文本时,横幅中的图像会发生变化。
我想知道如何使它在ie8中兼容..
我使用本教程提出了 js:
http://www.javascriptkit.com/script/script2/rolldifferent.shtml
我也试图将鼠标移出然后图像会改变。
下面是js代码:
<script type="text/javascript">function changeimage(towhat,url){if (document.images){document.images.targetimage.src=towhat.src gotolink=url}}functionwarp({window.location=gotolink}</script>
<script>var myimages=new Array()var gotolink="#"function preloadimages(){for (i=0;i<preloadimages.arguments.length;i++){myimages[i]=newImage()myimages[i].src=preloadimages.arguments[i]}}preloadimages("map_wm_hover.gif", "map_wm_hover2.gif","map_wm.gif")</script>
这是CSS:
<div id="base"><div id="mapcontainer"><a href="javascript:warp()"><img src="map_wm.gif" name="targetimage" border=0></a></div>
<div id="textcontainer"><div class="textboxinner1"><a href="index.html"onMouseover="changeimage(myimages[2],this.href)">8CCC REQUESTS/TALKBACK</a></div>
<div class="textboxinner2"><a href="index.html"onMouseover="changeimage(myimages[1],this.href)">Alice Springs 8952 7771</a></div>
<div class="textboxinner2"><a href="index.html"onMouseover="changeimage(myimages[0],this.href)">Tenant Creek 8952 7182</a></div>
<div class="textboxinner3"><span class="t3nonelink">...other contact details <a href="index.html" onMouseover="changeimage(myimages[2],this.href)">here</a></span></div>