我需要有关 IE6+ 中出现的错误消息的帮助。 请注意,代码运行良好。
消息:需要对象
线路:38
字符数:4
代码:0
URI:http://localhost/dropbox/panorama/index.php?lang=gr
第 38 行的实际内容如下:
<script type="text/javascript">
$(document).ready(function(){
slideShow();
});
</script>
第 38 行是我调用“slideShow()”函数的地方
另请注意,这些函数存储在外部文件中。
这些是外部文件的内容:
$(function slideShow() {
//Set the opacity of all images to 0
$('#gallery li').css({opacity: 0.0});
//Get the first image and display it (set it to full opacity)
$('#gallery li:first').css({opacity: 1.0});
//Call the gallery imgGallery to run the slideshow, 5000: 5 seconds interval
setInterval('imgGallery()',4000);
});
$(function imgGallery() {
//Get the first image
var current = ($('#gallery li.show')? $('#gallery li.show') : $('#gallery li:first'));
//Get next image, if reached last image, start over from the first image
var next = ((current.next().length) ? (current.next()) : $('#gallery li:first'));
//Set the fade in effect for the next image
next.css({opacity: 0.0})
.addClass('show')
.animate({opacity: 1.0}, 1000);
//Hide current image
current.animate({opacity: 0.0}, 1000)
.removeClass('show');
});
有什么建议吗?
最佳答案
尝试将 setInterval('imgGallery()',4000);
替换为 setInterval(imgGallery,4000);
如果这不起作用,这应该:
setInterval(function(){imgGallery();},4000)
关于IE 中的 JavaScript 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5594017/