实例可以直接运行查看效果。很方便快捷

 

[html] view plain copy
  1. <html>   
  2. <head>   
  3. <meta http-equiv="content-Type" content="text/html;charset=gb2312">   
  4. <style type="text/css">   
  5. <!--   
  6. *{margin:0;padding:0;}   
  7. .ifr_div{width:600px;height:600px; position:relative;}   
  8. .ifr_div img{ vertical-align:middle;}   
  9. .proccess{border:0px solid;border-color:#009900;height:600px;line-height:600px;width:600px;text-align:center;background:#eee;margin:0;position:absolute;top:0;left:0;}   
  10. .proccess b{vertical-align:middle;background:url(http://ok22.org/upload/images/20110902143538381.gif) no-repeat 0 center;padding-left:35px;display:inline-block;}   
  11. -->   
  12. </style>   
  13. </head>   
  14. <body>   
  15. <div class="ifr_div">   
  16.     <div class="proccess" id="loading"><b>正在加载中。。。</b></div>   
  17.     <iframe id="sfa" name="sfa" frameborder="0" scrolling="auto" height="600" width="600"></iframe>   
  18. </div>   
  19. <script language="JavaScript">   
  20. var iframe = document.getElementById("sfa");    
  21. iframe.src = "http://www.ok22.org";    
  22. if (iframe.attachEvent){    
  23.     iframe.attachEvent("onload", function(){   
  24.     document.getElementById("loading").style.display="none";   
  25.     });    
  26. } else {  www.2cto.com  
  27.     iframe.onload = function(){   
  28.     document.getElementById("loading").style.display="none";   
  29.     };    
  30. }    
  31. </script>   
  32. </body>   
  33. </html>
posted on 2017-06-14 09:39  变脸小伙  阅读(209)  评论(0编辑  收藏  举报