0
A
回答
0
得到新窗口的onLoad()事件的參數父窗口,通知新窗口已經被加載。
我希望這能解決您的問題。
0
下面是的一個示例,將函數放入子窗口中,然後讓子窗口運行它。 showTitle
函數將只顯示當前文檔標題。子頁面將等待特定功能並在到達時調用它。
parent.html:
<html>
<head>
<title>parent</title>
</head>
<body>
<script>
function showTitle() {
alert('Page Title = '+this.document.title);
}
function childLoaded() {
showTitle();
var childWnd=document.getElementById('fchild').contentWindow;
if (!childWnd) return;
childWnd.newFunc=showTitle;
}
</script>
parent<br />
<iframe id=fchild src="child.html" width=300 height=300 onload="childLoaded()"></iframe>
</body>
</html>
child.html:
<html>
<head>
<title>child</title>
</head>
<body>
<script>
var waiter,newFunc=null;
function waitFunc() {
if (newFunc) {
clearInterval(waiter);
newFunc();
}
}
waiter=setInterval(waitFunc, 1000);
</script>
child
</body>
</html>
相關問題
- 1. 打開的窗口中自我並執行JavaScript的新窗口
- 2. 如何打開新窗口並在新窗口中執行方法?
- 3. 打開新的終端窗口並執行命令
- 4. 在新窗口中執行href並打開URL
- 5. 如何打開一個新的窗口或選項卡併爲其執行javascript執行?
- 6. shell腳本 - 打開xterm窗口執行命令,並繼續執行腳本
- 7. 在新窗口中打開PDF,打印PDF並關閉窗口。如何在javascript中執行此操作
- 8. 在新窗口中執行
- 9. 從節點打開URL並執行javaScript
- 10. 如何在php中打開終端窗口並執行命令?
- 11. 關於提交,打開窗口並執行功能
- 12. 如何在JavaFX中打開新窗口時執行代碼?
- 13. C++在已打開的窗口中執行「打開」
- 14. 打開新窗口並在該新widnow上運行javascript
- 15. 執行Hann窗口
- 16. 如何在新打開的彈出窗口上執行Javascript或jQuery?
- 17. 在模態窗口中執行JavaScript的
- 18. 打開新窗口的JavaScript
- 19. 的Javascript打開新窗口
- 20. 如何在執行sbt命令並打開shell後執行
- 21. 如何防止窗口(選項卡)打開一個新的,並提醒彈出窗口後執行
- 22. html javascript打開新窗口,並關閉當前窗口
- 23. 只在操作中打開一個窗口已執行
- 24. Jframe窗口不能用我的可執行文件jar打開
- 25. 讓可執行文件打開自己的終端窗口
- 26. 如何在執行後保持控制檯窗口打開?
- 27. 在執行硒腳本時獲取chrome.exe彈出窗口打開
- 28. C++可執行文件打開命令窗口
- 29. pygame代碼沒有執行(窗口不會打開)
- 30. 關閉窗口執行
腳本應該可以,只要這兩個窗口是完全相同的主機名父母和孩子之間的窗口進行交互。 – Jay 2012-08-10 09:49:11
是的..它是相同的域和主機..我怎麼能做到這一點? – user1578707 2012-08-11 08:05:41