首先,我從我的頁面獲取此iframe。從iframe中的父窗口調用javascript函數,但iframe src來自遠程機器
<iframe src="https://192.168.100.87/index.html">
<p>Browser does not support iframe</p>
</iframe>
我從我的頁面頭標記有以下腳本。
<head>
<script type="text/javascript">
function callMe(){
alert('called');
}
</script>
</head>
而且我從遠程機器的index.html中獲得以下代碼。
<body>
<input type="button" value="Click" onClick="window.parent.callMe()" />
</body>
正如你所看到的,我打電話給我的主頁的功能,我的iframe被包括在內。 但不幸的是我不能調用該函數。
這是可能的,我在這裏失蹤了什麼? 謝謝
你先試過了嗎? – 2013-03-15 03:48:35
是的。它不工作。 :) – 2013-03-15 03:49:17
所以這就是你的答案...大聲笑.. :) – 2013-03-15 03:50:41