编辑下面的代码:【加编码】
<html> <head> <script> function changeStyle() { var x=document.getElementById("myframe"); var y=(x.contentWindow || x.contentDocument); if (y.document)y=y.document; y.body.style.backgroundColor="#0000ff"; } </script> </head> <body> <iframe id="myframe" src="/demo/demo_iframe.htm"> <p>Your browser does not support iframes.</p> </iframe> <br><br> <input type="button" onclick="changeStyle()" value="Change background color"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂