我在javascript中是一個小菜鳥,所以幫助我。我有這個在我的身體標記的底部:Iframe中的JavaScript不是正在執行
<iframe id="scriptFrame" name="scriptFrame" height="0" width="0">
<script type="text/javascript" language="javascript">
alert("Hello World");
parent.alert("Hello world");
function foo()
{
alert("Hello World");
}
</script>
</iframe>
兩個警報彈出。我究竟做錯了什麼?我嘗試添加html和head標籤,但沒有幫助。我也想這樣做的document.getElementById( 'scriptFrame')。contentWindow.foo()和幀[ 'scriptFrame']。FOO(),但既不工作
您是對的。感謝你和所有其他答覆者! – ForeverNoobie 2013-02-14 15:41:35