在javascript中更改图像源在Firefox中不起作用 [英] changing image source in javascript not working in firefox
本文介绍了在javascript中更改图像源在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想通过JavaScript更改图像源.它可以在IE中使用,但不能在Firefox和Google Chrome中使用.
代码如下:
I just want to change the image source through JavaScript. It works in IE but it didn''t work in Firefox and Google Chrome.
Code is written below:
which_image_loaded = 0;
numberofimages = 14;
ImageNames = new Object();
ImageNames.length = numberofimages - 1;
for (counter = 0; counter < numberofimages; counter++) {
file_number = counter + 1;
filename = (".\\books\\\cred\\image" + file_number + ".jpg");
ImageNames[counter] = filename;
}
function imgthumb(imgnum)
{
document.getElementById("myimage").src = ImageNames[imgnum];
}
推荐答案
看看这篇文章:
http://stackoverflow.com/Questions/5793738/cannot-change-src-of-image-with-javascript-in-some-versions-of-chrome [
Hi,
Take a look at this post:
http://stackoverflow.com/questions/5793738/cannot-change-src-of-image-with-javascript-in-some-versions-of-chrome[^]
I hope it helps,
Cheers
这篇关于在javascript中更改图像源在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文