一种很常见的写法:
document.write('<scr'+'ipt src="http://a.com/b.js" type="text/javascript"></scr'+'ipt>');
直到被杀毒软件提示有恶意代码才发现这也是不安全的,汗……
那就只好改成这样了:
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'http://a.com.cn/b.js';
document.getElementsByTagName('head')[0].appendChild(s);
})();
搜了一下,原来还有“邪恶”的eval,具体可以看这里:网马解密大讲堂——网马解密中级篇(Document.write篇)。
您可能对这些文章也感兴趣:- Mootools 1.2教程(14)——定时器和哈希简介
- 实验品:所见即所得在线编辑器
- Firefox下和IE下的单击和双击事件差异
- Mootools 1.2系列教程目录
- Mootools常用方法扩展(四)
- Mootools常用方法扩展(三)
- Mootools 1.2教程(21)——类(二)
- 在JavaScript应用中使用Flash来存储本地数据
- JavaScript的弱类对象及继承实现方式
- JavaScript奇怪的比较——隐式类型转换
与该文相关的评论:(我也想说几句)
Copyright © 2005-2008,Fdream All Rights Reserved
Processed in 0.1718794 second(s) , unknow queries
Powered by OWord V0.1, Even Not Alpha
(此博客程序为半成品,请勿索取,以免给您的心灵造成创伤^_^)
鄂ICP备05026031号
Processed in 0.1718794 second(s) , unknow queries
Powered by OWord V0.1, Even Not Alpha
(此博客程序为半成品,请勿索取,以免给您的心灵造成创伤^_^)
鄂ICP备05026031号
2009-9
我来说两句:
用户中心
日志分类

最新日志
统计信息





