首页 > 语言 > JavaScript > 正文

JS去除iframe滚动条的方法

2024-05-06 16:18:04
字体:大 中 小
来源:转载
供稿:网友

这篇文章主要介绍了JS去除iframe滚动条的方法,涉及javascript操作iframe中属性的技巧,非常具有实用价值,需要的朋友可以参考下

本文实例讲述了JS去除iframe滚动条的方法。分享给大家供大家参考。具体如下:

下面的代码可以通过修改scrolling来去除iframe的滚动条

 

 
  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <script> 
  5. function removeScroll() 
  6. { 
  7. document.getElementById("myframe").scrolling="no"; 
  8. } 
  9. </script> 
  10. </head> 
  11. <body> 
  12. <iframe id="myframe" src="/default.asp" scrolling="auto"> 
  13. <p>Your browser does not support iframes.</p> 
  14. </iframe> 
  15. <p>The value of the scrolling attribute is: 
  16. <script> 
  17. document.write(document.getElementById("myframe").scrolling); 
  18. </script> 
  19. <p> 
  20. <input type="button" onclick="removeScroll()" 
  21. value="Remove Scrollbars"> 
  22. <p>Internet Explorer, Google Chrome, Opera,  
  23. and Safari have problems with setting  
  24. the scrolling attribute.</p> 
  25. </body> 
  26. </html> 

希望本文所述对大家的javascript程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选