0
我试图添加外部JavaScript代码,此代码:使用document.write内加载外部JavaScript文件,其中文件撰写使用
function get_js(b){
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = b;
head.appendChild(script);
}
这种外部JavaScript代码:
document.write('<script language="JavaScript">document.write(\'<div id="something" style="position: fixed; top: 0; bottom: 0; left: 0; right: 0;"> <\/div>\');...
当我想从这个文件执行功能,我得到这个错误:我得到这个错误:
ReferenceError: some_function is not defined
我以为th在JS代码中的document.write是问题。有谁能够帮助我?
在此先感谢!
///
OK,理解了它与POSTSCRIBE:https://github.com/krux/postscribe
你应该完全避免文件撰写:http://stackoverflow.com/a/802943/3299157 – Ageonix
是的,我知道,但这是第三方脚本。 –