本文实例讲述了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程序设计有所帮助。