http://www.cnblogs.com/rubekid/p/4851988.html 你真的了解 console 吗 2014
http://www.codeceo.com/article/javascript-debug-skills.html 最全面的JavaScript调试技巧总结 2016-4-18
console控制台: 2016-4-18
console.table([[1,2,2,3],['a','b','c','d']]);//输出表格 console.log('%c啊啊啊啊','font-size:60px;color:red;text-shadow:4px 4px 10px #999999');//输出大红字
运行时间测试:
var _msg = ""; _msg += "开始:"+new Date().getTime(); _msg += "开始:"+new Date().getTime(); $(".test").html(_msg); alert(_msg);
console.log( new Date().getTime() );
滚屏测试:(可以去除scroll滚屏事件多此请求问题)
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript"> $(function(){ var timer; $(window).scroll(function () { clearTimeout(timer); timer = setTimeout(function () { console.log(new Date().getTime()); console.log($(document).scrollTop()); }, 100); }); }); </script>
模拟事件:
$("#aa").trigger("click");
固定语句:
<script type="text/javascript"> $(function(){ $("#button").click(function(){ }); }); </script> <input type="button" id="button">
...