基本文本处理---学习笔记
2013-04-25 13:31
357 查看
function CrossDomainName(target, agent, callback, security) { if (typeof target !== 'string' || typeof agent !== 'string' || typeof callback !== 'function') { throw '参数错误'; } this.state = 0; this.target = target; this.agent = agent; this.callback = callback || Function; this.security = security || true; this.iframe = document.createElement('iframe'); var self = this; function onload() { if (self.state === 1) { var data = self.iframe.contentWindow.name; self.callback.call(self.iframe, data); if (self) { self.iframe.contentWindow.document.close();//关闭文档流 self.iframe.contentWindow.close();//关闭Iframe document.body.removeChild(self.iframe);//移除Iframe } } else if (self.state === 0) { self.state = 1; self.iframe.contentWindow.location = self.agent; } } if (document.attachEvent) { this.iframe.attachEvent('onload', onload); } else if (document.addEventListener) { this.iframe.addEventListener('load', onload, false); } else { this.iframe.onload = onload; } this.iframe.src = this.target; document.body.appendChild(this.iframe); } //调用 new CrossDomainName('http://www.kingwell.com/kingwell.html', 'http://name.b.com/adfas.html', function (data) { alert(data); });
相关文章推荐
- ubuntu之shell编程学习笔记5——基本文本处理
- Perl语言学习笔记 9 正则表达式处理文本
- .NET/Dot Net学习笔记---.net理解,C#.net的基本类型,字符串转义字符处理..
- 学习笔记之文本处理工具
- Spark学习笔记——文本处理技术
- [linux学习笔记]第3天:变量分类,重定向,管道命令,程序执行流,文本处理类命令, 正则表达式,短路操作符
- Python学习笔记一 基本语法、变量类型、时间处理
- Linux学习笔记033_8文本处理
- OpenCV学习笔记:基本的图像处理
- Perl 学习笔记-正则表达式处理文本
- 【DWR】学习笔记(一):基本配置&&前后台的数据传输与处理
- Opencv学习笔记(三)--图像处理的基本操作
- Linux菜鸟学习笔记(常用基本命令之文件处理)
- shell脚本学习笔记之文本处理命令
- linux的文本处理(学习笔记)
- coursera NLP学习笔记之week1课程介绍&基础的文本处理
- [离散时间信号处理学习笔记] 3. 一些基本的LTI系统
- C++学习笔记十六 - 文本处理string.H 类的用法,
- IPhone学习笔记二-----处理基本交互
- 《Web编程入门经典》学习笔记 - Lesson01:创建结构化文档:XHTML简介、核心元素、属性组与基本文本格式