js 控制加载 js 文件
看到有种代码是这样写的,我就要笑它, script 写分家了。<script type="text/javascript">
var js_path = "http://www.baidu.com/b.js";
document.write('<script type="text/javascript" src="' + js_path + '">');
document.write("</scr");
document.write("ipt>");
</script>
直到有一次,我自己写的代码是这样的
<script type="text/javascript">
var js_path = "http://www.baidu.com/b.js";
document.write('<script type="text/javascript" src="' + js_path + '">');
document.write("</script>");
</script>
我汗了,发现根本不执行,后来我想到某人的写法,明白了。
如果以上代码写在 .js 文件里面没有任何问题,如果写在 html 中就有问题了。
- 上一篇:html 常用属性前端工程师需知
- 下一篇:ie6 css js 兼容性不定时更新