问题描述
我正在尝试调试在IE上不起作用的jQuery(Tools)脚本.可以在此处找到示例:
I am trying to debug my jQuery(Tools) script that is not working on IE. An example can be found here:
http://dl.dropbox.com/u/16799097/www/demo /jQuery_Slider/index.html
它正确加载,发生第一个(滑动)事件,然后没有任何追加.
It loads correctly, the first (sliding) event occurs, and then nothing append.
当我尝试通过使用开发人员工具重新加载页面(按F12键)来调试脚本时,一切都像一个超级按钮……如果无法调试,该怎么办?
When I try to debug my script by reloading the page with the developer-tools (press the F12 key), everything works like a charm ... What can I do if I cannot debug ?
任何帮助将不胜感激,我被困住了...
Any help would be appreciated, I am stuck ...
推荐答案
错误是(在slider.js
中):
'console' is undefined
console
对象.然后,不再存在JavaScript错误,一切正常.
The console
object is only defined in IE when you open the Developer Tools. Then, there's no longer a JavaScript error and everything works.
要解决此问题,您可以删除/注释console.log
调用,或在第一个JavaScript块中添加如下内容:
To fix the problem, you can either remove/comment out the console.log
call, or add something like this as your very first block of JavaScript:
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info, log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
(摘录自 http://html5boilerplate.com/的片段)
这篇关于jQuery脚本仅在ie8/9开发人员工具下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!