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