Friday, December 14, 2007

Javascript document.write usage

var fragment = document.createDocumentFragment();
var testScript = document.createElement('script');
testScript.setAttribute('type', 'text/javascript');
testScript.setAttribute('src', 'http://www.test.com/test.php');// test.php 中有document.write('<iframe src....></iframe>')
fragment.appendChild(testScript);
document.body.appendChild(fragment);

程序在载入当前页和test.php后就不能再载入iframe里的scr指向的页面,并页面锁死,这个同在页面载完后调Function输出一个document.write一样的错误.

No comments :