也许这:
<html>
<body>
<p>Images:</p>
<img name=image0>
<img name=image1>
<img name=image2>
<img name=image3>
End of document body.
</body>
<script type="text/javascript">
function LoadImage(imageName,imageFile)
{
if (!document.images) return;
document.images[imageName].src = imageFile';
}
LoadImage('image4','number4.gif');
LoadImage('image5','number5.gif');
LoadImage('image6','number6.gif');
LoadImage('image7','number7.gif');
</script>
</html>
或者这样:
<html>
<body>
<p>Images:</p>
<img name=image0 onLoad="LoadImage('image1','number1.gif')">
<img name=image1 onLoad="LoadImage('image2','number2.gif')">
<img name=image2 onLoad="LoadImage('image3','number3.gif')">
<img name=image3>
End of document body.
</body>
<script type="text/javascript">
var loadingImage = false;
function LoadImage(imageName,imageFile)
{
if ((!document.images) || loadingImage) return;
loadingImage = true;
if (document.images[imageName].src.indexOf(imageFile)<0)
{
document.images[imageName].src = imageFile;
}
loadingImage = false;
}
LoadImage('image0','number0.gif');
</script>
</html>
我知道这是不是你的代码的修正,但我不能看到什么错......
这是一个非常兼容的方案!
希望它有帮助!资源:
http://www.cryer.co.uk/resources/javascript/script3.htm
尝试使用图片[i]中。的style.display = '块';而不是图片[i] .style.display =''; – lock 2010-10-14 23:09:53
你有什么问题?我复制了你的代码,并在IE7,IE8和IE9中运行,没有任何问题。 – gilly3 2010-10-14 23:17:33
“做问题”? – titaniumdecoy 2010-10-14 23:24:00