1

有谁知道如何获取以下内容以报告 javascript 错误?(任何浏览器)


<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js">
    </script>
    <script type="text/javascript">

        ObjWithEvent = {
            testEvent: new YAHOO.util.CustomEvent("testEvent")
        };

        ObjSubscriber = {
            handleTestEvent: function(){
                alert('the next line will not show up in the error console');
                not_a_valid_function_bro();
            }
        };

        ObjWithEvent.testEvent.subscribe(ObjSubscriber.handleTestEvent);
        ObjWithEvent.testEvent.fire();
    </script>
</head>
<body>
</body>

4

1 回答 1

10

可能是有史以来选择最差的默认设置之一..... YAHOO.util.Event.throwErrors 默认设置为 false,因此如果您想查看错误:

YAHOO.util.Event.throwErrors = true;

于 2009-02-06T18:33:45.633 回答