SCRIPT438:对象不支持属性或方法'debug'

时间:2012-10-31 12:56:25

标签: javascript internet-explorer

我试图搜索这个但无济于事。我的代码由网站上一个真正的好人提供,然后我修改了属性,使我适合他们需要去的地方的元素,但是,一切在所有浏览器中工作正常,也就是说,除了IE - 漂亮很多版本。我在IE9中运行调试,并给出了这个错误“

  

SCRIPT438:Object不支持属性或方法'debug'

它引用的代码部分是

function resizeContent() {
    // Retrieve the window width
    var viewPortWidth = $(document).width();
    var viewPortHeight = $(document).height();

    $(".content").each(function(index, element) {

        var jElement = $(this);
        if (jElement.hasClass(currentContentColor)) {
            console.debug('resize content selected (' + (viewPortWidth - 160) + ')');
            // If current content, juste resize the width and height
            jElement.css({
                width: (viewPortWidth - 160) + "px",
                height: viewPortHeight + "px"
            });
        }
        else {
            console.debug('resize content (' + (viewPortWidth - 160) + ')');
            // If not current content, resize with, height and left position
            // (keep content outside)
            jElement.css({
                width: (viewPortWidth - 160) + "px",
                left: viewPortWidth + "px",
                height: viewPortHeight + "px"
            });
        }
    });
}

有问题的具体行是

console.debug('resize content (' + (viewPortWidth - 160) + ')');

或者至少这就是IE所说的问题

是否有解决此问题和IE的工作 - 我正在慢慢学习 - 但这远远超出我所知道的范围。我搜索了谷歌和这里的调试错误,但找不到任何东西。

该网站为http://www.crazyedits.co.uk

提前感谢您就此问题提供的任何帮助。

1 个答案:

答案 0 :(得分:7)

根据the documentationconsole.debug已被弃用;应该使用console.log代替。

  

log()的别名;添加此项是为了改善与已使用debug()的现有站点的兼容性。但是,您应该使用console.log()。

在任何情况下,debuglog仅用于将调试信息打印到控制台 - 它们应从生产代码中删除。

相关问题