我有這樣的功能:fireEvent到top.document.body
function doSomething(e) {
if (!e) var e = window.event;
alert(e.type);
}
當HTML(Master.html)頁面已準備好...我叫這個其他:
var iniciarTimeOut = function (e) {
document.onload = doSomething;
window.onmousedown = doSomething;
window.onkeypress = doSomething;
};
我有一個IFRAME放進Master.html,我要檢測的事件爲Iframe.html的,但在火Master.html我這個嘗試的事件:
document.onmousedown = top.document.body.fireEvent("onload");
document.onkeypress = top.document.body.fireEvent("onmousedown");
document.onload = top.document.body.fireEvent("onload");
我該怎麼做?
這是一個完整的使用postMessage控制Clien-Side中的TimeOut的實現示例http://forums.ext.net/showthread.php?18578-How-To-Timeout-(Client-Side)-using-postMessage- (HTML5)-with-Countdown-alert&p = 80171#post80171 – Equiman 2012-04-23 15:22:31