Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在internet explorer中获取png上的图像错误框?_Javascript_Jquery_Html_Css_Internet Explorer - Fatal编程技术网

Javascript 在internet explorer中获取png上的图像错误框?

Javascript 在internet explorer中获取png上的图像错误框?,javascript,jquery,html,css,internet-explorer,Javascript,Jquery,Html,Css,Internet Explorer,我对Internet Explorer有一个非常奇怪的问题。我正在用javascript预加载一些图像并显示它们。它们都显示良好,但会显示一个图像错误框 图像在这里 我以这种方式在Javascript中预加载图像 function LoadImage(imageName,imageFile) { if(!document.images) return; document.images[imageName].src = imageFile; } $(document).ready(functi

我对Internet Explorer有一个非常奇怪的问题。我正在用javascript预加载一些图像并显示它们。它们都显示良好,但会显示一个图像错误框

图像在这里

我以这种方式在Javascript中预加载图像

function LoadImage(imageName,imageFile)
{
 if(!document.images) return;
 document.images[imageName].src = imageFile;
}
$(document).ready(function() {
LoadImage('image0','images/image.png');
});
然后我在html中使用它们

<img name=image0 border=0>

同样,所有的图像都显示得很好。此错误出现在IE的所有版本中


谢谢

是不是只有一个.png在IE中这么做?您可能希望在Photoshop等照片编辑器中打开图像,以确保它是RGB、72dpi等。不久前,当客户向我提供CMYK JPEG时,我遇到了类似的问题,唯一不显示它们的浏览器是IE。将颜色空间转换为RGB就成功了


确保图像在所有浏览器中都能显示的最简单方法可能是Photoshop的Save For Web功能。

您应该通过
document.getElementById
,而不是
document.images