2012-04-01 57 views
0

有沒有辦法將swf的大小(例如大小爲750 X 750)更改爲500 x 500,但只有當瀏覽器是IE6,IE7,IE8,IE9時?在瀏覽器中縮小swf是Internet Explorer

<script type="text/javascript" src="swffit.js"></script> 
    <script type="text/javascript"> 
     var flashvars = {}; 
     var params = {}; 
     params.allowfullscreen = true; 
     var attributes = {}; 
     attributes.id = "MYSWF"; 
     attributes.name = "MYSWF"; 
     swfobject.embedSWF("MYSWF.swf", "MYSWF","100%","100%","9.0.0",false,flashvars,params,attributes); 
     swffit.fit("MYSWF", 750, 750); 
    </script> 
+0

爲什麼在不同的瀏覽器中需要不同的尺寸? – 3Doubloons 2012-04-01 02:52:03

+0

因爲,IE9有一些怪異的行爲... – cMinor 2012-04-01 03:17:09

回答

1

我想,你的意思是,只有當瀏覽器是IE。嘗試這個;

var flashvars = {}; 
var params = {}; 
params.allowfullscreen = true; 
var attributes = {}; 
attributes.id = "MYSWF"; 
attributes.name = "MYSWF"; 
swfobject.embedSWF("MYSWF.swf", "cementera","100%","100%","9.0.0",false,flashvars,params,attributes); 

if (navigator.appName == 'Microsoft Internet Explorer') { 
    swffit.fit("cementera", 500, 500); 
} else { 
    swffit.fit("cementera", 750, 750); 
} 
相關問題