JS经验库

1.IE状态栏无法结束的问题

 1 function clearStatusBar(){
 2      this.bd = document.body;
 3      this.tmp = document.creatElement("div");
 4      this.tmp = style.display = "none";
 5      this.tmp.innerHTML = "<iframe border='0' frameborder='0'></irame>";
 6      this.bd.append(this.tmp);
 7      return this;
 8 }
 9 
10 window.onload = funtion(){
11     clearStatusBar();
12 }

个人比较赞成 “对于页面中多iframe之间进行通讯时,IE无法准确判断页面是否加载完成”  这个说法。

2.在IE7及更早版本中,如果错误发生在位于外部文件的脚本中,lineNumber 通常会与错误所在的 lineNumber 差1。如果是嵌入在页面中的脚本发生错误,

则行号就是错误所在的行号。

3.try-catch-finally,错误处理

  在catch中使用catch(error){alert(error.message)}; message属性可以做到跨浏览器。IE、Safari、FrieFox等都有自己其他实现。

  务必要记住的:只要代码中包含finally子句,无论是try 还是 catch 语句块中的 retrun 语句都讲会被忽略。

原文地址:https://www.cnblogs.com/yiliweichinasoft/p/3719795.html