我只在 IE9 上收到错误消息“SCRIPT5007:预期对象”。有2个相同的错误。一个在开始时位于 $(document),另一个标记为“<- error here”
<script>
$(document).ready(function(){
var imagePath = "/sites/all/modules/custom/sixdegrees_right_menu/images/";
$(".menu-holder").mouseover(function()
{
//$(this).children(".menu-title").children(".menu-bg").hide();
//$(this).children(".menu-title").children(".menu-name").css({"float":"none"});
//$(this).children(".menu-title").children(".menu-text").css({"float":"none"});
var imgSrc = $(this).children(".menu-icon").find("img").attr("src");
imgSrc = imgSrc.replace(imagePath, "");
imgSrc = imagePath + "h-" + imgSrc;
$(this).children(".menu-icon").find("img").attr("src", imgSrc);
<- error here
//$(this).children(".menu-title").children(".menu-name").children("img").animate({"left": "0px"}, "slow");
//$(this).children(".menu-title").children(".menu-text").animate({"left": "0px"}, "slow");
});
});
</script>
还有一些注释行,我没有足够的权限删除它,除非我可以声明一些东西。
最佳答案
将 type="text/javascript"添加到您的脚本标记中,并确保在尝试使用它之前已成功包含 jQuery。
关于javascript - 仅在 IE9 上出现 JS 错误 "Object expected",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9612822/