我有一個主要的頁面:我想捕捉的對象標記事件
<script src='js/jquery-1.10.2.js'></script>
<script>
$(document).ready(readyFn);
function readyFn() {
$('#cartelera01').attr('data','prueba5.html');
function doSomething(){
console.log('do something when the event of the object is triggered');
}
}
</script>
<html>
<body>
<div>
<object id="cartelera01" type="text/html" data="" width="500" height="300" style='overflow-x: hidden;overflow-y: hidden;'
onpagehide="doSomething()"
></object>
</div>
</body>
</html>
,並有prueba5.html太:
script src='js/jquery-1.10.2.js'></script>
<script>
$(document).ready(readyFn);
function readyFn() {
console.log('page init');
setTimeout(function()
{
console.log('after 3 seconds, page end'); //here I want to fire event object of principal page
}, 3000);
}
</script>
<html>
<body>
<div style="left:0;width:300;heigth:200;background:black;">
<img src="bola1.png" style='top:0;left:0px;width:180;height:180px;position:absolute;'>
</div>
</body>
</html>
我想,當頁面prueba5.html結束自動(3秒後),主頁的對象「cartelera01」知道頁面prueba5.html已經結束,並且執行某些操作。 任何人都可以幫助我嗎? 在此先感謝。
使用ajax或在您的主頁中運行prueba5.html作爲隱形iframe,對您有意義嗎? – Godinall