這篇文章主要介紹了JS去除iframe滾動條的方法,涉及javascript操作iframe中屬性的技巧,非常具有實用價值,需要的朋友可以參考下
本文實例講述了JS去除iframe滾動條的方法。分享給大家供大家參考。具體如下:
下面的代碼可以通過修改scrolling來去除iframe的滾動條
- <!DOCTYPE html>
- <html>
- <head>
- <script>
- function removeScroll()
- {
- document.getElementById("myframe").scrolling="no";
- }
- </script>
- </head>
- <body>
- <iframe id="myframe" src="/default.asp" scrolling="auto">
- <p>Your browser does not support iframes.</p>
- </iframe>
- <p>The value of the scrolling attribute is:
- <script>
- document.write(document.getElementById("myframe").scrolling);
- </script>
- <p>
- <input type="button" onclick="removeScroll()"
- value="Remove Scrollbars">
- <p>Internet Explorer, Google Chrome, Opera,
- and Safari have problems with setting
- the scrolling attribute.</p>
- </body>
- </html>
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答
圖片精選