DIV CSS 佈局教程網

jquery.bgiframe.js 在 IE9 下出現 INVALID_CHARACTER_ERR 錯誤的解法
編輯:JQuery特效代碼     

在 IE9 環境下載入 jquery.bgiframe.js 時,會跳出類似下面的錯誤訊息:

SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5)
jquery.bgiframe.js, 行 8 字符 976

出問題的程式碼大致如下:

{if(!$('iframe.bgiframe',this)[0])this.insertBefore(document.createElement(html),this.firstChild);};

上網查了一下,找到幾種處理方式。

方案一:

this.insertBefore(document.createElement('html'),this.firstChild);

簡單來說,就是在建立元素時,替原本沒加引號的 html 補上一對引號即可解決。目前找到的就是這個做法,日後若有更好的方案再補充。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved