随笔分类 -  Js/Web

IE firefox下获取iframe中的document内容
摘要:IE下: 1.通过document.frames['frameId'].document访问: var frame = document.frames['frameId']; var innerDoc = frame.document; 2.通过contentWindow.document访问: var frame = document.getElementById('frameId'); var innerDoc = frame.contentWindow.document; 这样innerDoc得到了iframe内的document,可以用i 阅读全文

posted @ 2013-06-05 11:25 qinxike 阅读(646) 评论(0) 推荐(0)

关于javascript中的constructor与prototype
摘要:constructor与prototype,先参考这篇文章:constructor与prototype分析简单点来说,就是1.Function(类)有prototype属性可用,prototype指向一个对象,该对象为所有Function实例共享。2.prototype对象有一个constroctor属性,指向Function(类)的构造函数。3.所有对象实例都自动拥有prototype对象的所有属性和方法,所以对象实例可直接访问constructor,与Function.prototype.constructor一致。下面结合代码来分析分析:1.1 声明一个类,类名为Ffunction F( 阅读全文

posted @ 2013-04-26 18:35 qinxike 阅读(407) 评论(0) 推荐(0)

javascript父子页面(iframe)互相访问
摘要:javascript父子页面互相访问如:main.html页面(父页面)有:<body><div > <input type="text" id="m1" name="m1"/> <iframe name='frame1' id='frame1' src='sub.html' width='100%' height='100%' frameBorder='0'/></div>< 阅读全文

posted @ 2013-04-16 18:06 qinxike 阅读(214) 评论(0) 推荐(0)

JavaScript的execCommand指令用法(转)
摘要:/* *该function执行copy指令 */ function fn_doufucopy(){ edit.select(); document.execCommand('Copy'); } /* *该function执行paste指令 */ function fn_doufupaste() { tt.focus(); document.execCommand('paste'); } /* *该function用来创建一个超链接 */... 阅读全文

posted @ 2012-08-17 15:37 qinxike 阅读(536) 评论(0) 推荐(0)

iframe载入完成时的事件监听(转)
摘要:iframe载入完成时的事件监听经常会遇到这样一种情况。在iframe里嵌入另外一个页面时。如果iframe载入的页面响应较快,或许我们感觉不到页面载入的不同步,但试想,如果一个需要内嵌到iframe里的页面的响应很慢,这里会出现一种什么现象呢?这时将会出现所有页面已经载入完成,但在iframe元素处,将会出现空白,直到内嵌页面完成载入时,该空白处才会显示新载入的页面。可想而知,一个页面如果长时间的空白,对于浏览者来说将意味着什么。如果在内嵌页面未载入完成时,给出一种加载提示信息。如:“页面加载中”之类的,我想这对浏览页面用户来讲,将不再是煎熬,更是一种视觉上的享受。为了实现这样的效果,一般会 阅读全文

posted @ 2012-07-25 16:09 qinxike 阅读(440) 评论(0) 推荐(0)

获取iframe页面中的元素
摘要:在父页面 获取iframe子页面的元素代码如下:IE:var doc = document.frames('iframename').documentdoc.getElementById(...)FireFox:var doc = document.getElementById('iframeId').contentDocumentdoc.getElementById(...) 阅读全文

posted @ 2012-07-25 15:37 qinxike 阅读(177) 评论(0) 推荐(0)

导航