HTML5 跨浏览器 iframe 中的事件消息——从子到父?
父对象提供了从子级到主窗口的引用。
以下为父级代码。下面的指令触发 iFrame 每 3 秒向父窗口发送一条消息。无需从主窗口发送初始消息!
var a= window.addEventListener ? "addEventListener" : "attachEvent";// here a is the event method
var b= window[a];// here b is the eventer
var c= a== "attachEvent" ? "onmessage" : "message";// here c is the message event
// Listen to message from child window
b (c,function(e) {
var d= e.message ? "message" : "data";// here d is the key
var f= e[d];//here f is data
},false);
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP