【问题标题】:Why this jquery plugin giving error in IE but working fine in firefox?为什么这个 jquery 插件在 IE 中给出错误但在 Firefox 中工作正常?
【发布时间】:2010-04-24 14:18:29
【问题描述】:

此页面在 Firefox 中有效,但在 IE7 中无效

http://www.robwalshonline.com/demos/randomImageDemo/randomImage_plugin.html

这是插件http://www.robwalshonline.com/posts/jquery-plugin-random-image-on-page-load/的页面

如何在所有浏览器 FF、safari、chrome 和 IE 6、7、8 中实现这项工作

【问题讨论】:

  • 我不知道,但我会用服务器端语言来完成。

标签: javascript jquery xhtml cross-browser


【解决方案1】:

在列表或对象字面量的最后一个元素之后放置逗号在 FF 中有效,但在 IE 中无效:

myImages: ['image1.jpg', 'image2.jpg', 'image3.jpg', 'image4.jpg', 'image5.jpg', ] //put image names in this bracket. ex: 'harold.jpg', 'maude.jpg', 'etc'

因此,在 IE 中,winnerImage 将是未定义的,它会尝试在 http://www.robwalshonline.com/demos/randomImageDemo/images/undefined 处加载图像

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-09-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-04
相关资源
最近更新 更多