<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script type=text/javascript>
$(document).ready(function() {
jQuery.jqsxfg51nav = function(jqsxfg51navhover) {
$(jqsxfg51navhover).prepend("<span></span>");
$(jqsxfg51navhover).each(function() {
var linkText = $(this).find("a").html();
$(this).find("span").show().html(linkText);
});
$(jqsxfg51navhover).hover(function() {
$(this).find("span").stop().animate({
marginTop: "-40"
}, 250);
} , function() {
$(this).find("span").stop().animate({
marginTop: "0"
}, 250);
});
};
//下面是调用方法,一个页面也可以调用很多次
$.jqsxfg51nav("#menu1 li");
$.jqsxfg51nav("#menu2 li");
});
</script>
这是脚本代码,别的浏览器都没问题,只有IE一直报错,错误如下:
这是在网上找的js,我对这方面不怎么懂,求高手救命啊~~~~~
目测是你的代码使用了html5/css3的特性,IE8不支持。你需要判断下浏览器的版本用别的方法代替,或者平稳降级去掉这些特效。
$(document).ready(function() { jQuery.jqsxfg51nav = function(jqsxfg51navhover) { $(jqsxfg51navhover).prepend(""); $(jqsxfg51navhover).each(function() { var linkText = $(this).find("a").html(); $(this).find("span").show().html(linkText); }); $(jqsxfg51navhover).hover(function() { $(this).find("span").stop().animate({ marginTop: "-40" }, 250); } , function() { $(this).find("span").stop().animate({ marginTop: "0" }, 250); }); };
脚本最后边缺少一个});
你的js就是这点代码吗 没有其他的了吗 这段代码本身没有什么问题 看你截图报的错 你找一下就是啦 啊 我认为跟这段代码没多大关系
可以看下是不是少了引号的原因</p>
换个浏览器试试!