行業(yè)動態(tài)
flash自動適應分辨率、flash自適應分辨率
發(fā)布日期:2012-12-29 閱讀次數(shù):3207 字體大?。?a href="javascript:;" onclick="ChangeFontSize('content',16)">大

采用JS的方式使網(wǎng)頁中的flash自動適應分辨率、flash自適應分辨率代碼如下

JavaScript代碼
  1. <script type="text/javascript" language="JavaScript">  
  2. e = true;  
  3. var myWidth = 0, myHeight = 0;  
  4. iftypeof( window.innerWidth ) == 'number' ) {  
  5. myWidth = window.innerWidth;  
  6. myHeight = window.innerHeight;  
  7. else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {  
  8. myWidth = document.documentElement.clientWidth;  
  9. myHeight = document.documentElement.clientHeight;  
  10. else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
  11. myWidth = document.body.clientWidth;  
  12. myHeight = document.body.clientHeight;  
  13. }  
  14. if (myWidth<800){  
  15. myWidth=800;  
  16. }  
  17. if (myHeight<580){  
  18. myHeight=580;  
  19. }  
  20.   
  21. myWidth=myWidth-10;  
  22. myHeight=myHeight-10;  
  23. document.write('<OBJECT id="flashMovie" data="http://shss.zhiga.com/content/shss/uploadfiles/ydy.swf?myWidth='+ myWidth +'&myHeight='+ myHeight +'" type="application/x-shockwave-flash" WIDTH="'+ myWidth + '" HEIGHT="' + myHeight + '">');  
  24. document.write('<PARAM NAME=movie VALUE="http://shss.zhiga.com/content/shss/uploadfiles/ydy.swf?myWidth='+ myWidth +'&myHeight='+ myHeight +'">');  
  25. document.write('<PARAM NAME="FlashVars" VALUE="allowResize='+e+'" />');  
  26. document.write('<PARAM NAME=quality VALUE=high>');  
  27. document.write('<param name="BGCOLOR" value="#d3d3d3" />');  
  28. document.write('<EMBED src="http://shss.zhiga.com/content/shss/uploadfiles/ydy.swf?myWidth='+ myWidth +'&myHeight='+ myHeight +'" quality=high bgcolor="#d3d3d3"  WIDTH="'+ myWidth + '" HEIGHT="' + myHeight + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>');  
  29. document.write('</OBJECT>');  
  30. </script>