我使用的是一个简单的图像滑块脚本。它在大多数浏览器中都能完美工作。
当我在IE6中用默认图像测试它时,它运行得很好:给要加载的图像的默认路径是一些类似somesitename.com/image.jpg
的url;这适用于IE 6和其他现代浏览器。
但是,当我添加像someimages.jpg
这样的图像时,它不会在IE6中加载图像,而在其他浏览器中,它运行良好。
是不是我的javascript先支持一些URL路径,然后才支持图像路径?
下面的代码是我编辑图像路径的部分。。。
<script type="text/javascript">
var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [300,250], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [
["images/img-2.jpg", "#", "_new", "There's nothing like a nice swim in the Summer."],
["images/img-1.jpg", "#", "", ""],
["images/r-.jpg", "", "", "Eat your fruits, it's good for you!"],
["images/inside-image1.jpg", "", "", ""]
],
autoplay: [true, 2500, 5], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
},
onslide:function(curslide, i){ //event that fires after each slide is shown
//Keyword "this": references current gallery instance
//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})
</script>
您的someimages.jpg应该位于运行图像滑块代码的同一目录中,或者提供someimages.jpg 的完整路径
我假设您使用的SimpleGallery
脚本如下:http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm(我想就是这个,因为你给出的代码示例与该页上的代码示例完全相同)。
如果是,请注意,在该页面的顶部,它说明了脚本支持的浏览器:"FF1+IE7+Opr9+"。
换句话说,这个脚本不支持IE6。
你也许可以修复它,但它可能会涉及到对脚本本身代码的黑客攻击。可能不值得付出这样的努力。
同样值得指出的是,这个脚本不是jQuery插件。您已经将jQuery作为问题的标签之一,所以我认为您的网站上已经有jQuery了。如果是这样的话,肯定还有其他支持IE6的滑块脚本。我建议你最好的解决方案是尝试其中一种。
最后,一个大问题是:你真的需要支持IE6吗?如果你在中国,那么答案可能是肯定的,但除此之外,答案应该是否定的。IE6的使用率现在已降至使用中浏览器的0.3%左右,并且每月都在下降,即使如此,在不久的将来,当官方对IE6(和WinXP)的支持完全结束时,这0.3%中的许多公司将被迫升级。