2
最初はiframe srcは3.htmlで、idが 'p'の要素はありません。iframe srcを2.htmlに変更し、 'p'要素の値を11に変更したいと思います。仕事。誰かが何か解決策を教えてくれますか?iframe srcの変更直後にiframeのコンポーネントの値を変更するにはどうすればよいですか?
1)のiframe srcを変更します。私は何をしたいか
1つのイベントが単純です。
2)iframeの要素の値を変更します。
1.html
<script type="text/javascript">
function testIframe()
{
test1();
test2();
}
function test1()
{
document.frames('myFrame').src='2.html';
}
function test2()
{
document.frames('myFrame').document.getElementById('p').innerHTML='11';
}
</script>
<body>
<input type="submit" id="button" onClick="testIframe()" value="ok">
<iframe name="myIFrame" id="myFrame" src="3.html">
</body>
2.html
<body>
<p id="p">33</p>
</body>
3.html
<body>
</body>