這篇文章主要介紹了JS獲取iframe中marginHeight和marginWidth屬性的方法,涉及javascript操作iframe屬性的技巧,并分析了marginHeight和marginWidth屬性的功能,非常具有實用價值,需要的朋友可以參考下
本文實例講述了JS獲取iframe中marginHeight和marginWidth屬性的方法。分享給大家供大家參考。具體如下:
- <!DOCTYPE html>
- <html>
- <body>
- <iframe id="myframe" src="demo_iframe.htm"
- marginheight="50" marginwidth="50">
- <p>Your browser does not support iframes.</p>
- </iframe>
- <br><br>
- <p>The value of the marginheight attribute and marginwidth are:
- <script>
- document.write(document.getElementById("myframe").marginHeight);
- document.write(document.getElementById("myframe").marginWidth);
- </script>
- <p>
- </body>
- </html>
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答
圖片精選