简体   繁体   English

谁能告诉我这个脚本出了什么问题?

[英]Can anyone tell me what's wrong with this script?

The script is working just fine but IE is giving me the error "Done but with errors on page" and I can't figure out why. 脚本工作正常,但IE给我错误“完成但页面上有错误”,我不知道为什么。

(function($){ 
     $.fn.extend({  
         tabify: function() {
            function getHref(el){
                hash = $(el).find('a').attr('href');
                if(hash)
                    return hash.substring(0,hash.length-4);
                else
                    return false;
                }
            function setActive(el){
                $(el).addClass('active');
                if(getHref(el))
                    $(getHref(el)).show();
                else
                    return false;
                $(el).siblings('li').each(function(){
                    $(this).removeClass('active');
                    $(getHref(this)).hide();
                });
            }
            return this.each(function() {
                var self = this;

                $(this).find('li>a').each(function(){
                    $(this).attr('href',$(this).attr('href') + '-tab');
                });

                function handleHash(){
                    if(location.hash)
                        setActive($(self).find('a[href=' + location.hash + ']').parent());
                }
                if(location.hash)
                    handleHash();
                setInterval(handleHash,100);
                $(this).find('li').each(function(){
                    if($(this).hasClass('active'))
                        $(getHref(this)).show();
                    else
                        $(getHref(this)).hide();
                });
            }); 
        } 
    }); 
})(jQuery);

在Firefox上安装Firebug插件可以帮助您更好地了解无法正常运行的功能以及许多其他功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM