1、jquery代码:
1.1问题的版本:
$(function() {
haituheight();
$(window).resize(function(){
haituheight();
});
});
//改变高度和宽度的方法
function haituheight() {
var height = $(window).height()-$('.footer').height()-$('.header').height();
var width = $(window).width()-$(".main-left").width();
$("#FlexManyShips").css({"width":width,"height":height});
}
1.2 解决之后的版本:
$(function() {
var resize_window_height = $(window).height()-$('.footer').height()-$('.header').height();
var resize_window_width = $(window).width()-$(".main-left").width()-1;
haituheight(resize_window_height,resize_window_width);
$(window).resize(function(){
resize_window_height = $(window).height()-$('.footer').height()-$('.header').height();
resize_window_width = $(window).width()-$(".main-left").width()-1;
haituheight(resize_window_height,resize_window_width);
});
});
//改变高度和宽度的方法
function haituheight(haituhigh,width) {
if (navigator.appName.indexOf("Microsoft") != -1) {
var UA = navigator.userAgent;
var is360se = UA.toLowerCase().indexOf('360se') > -1 ? true : false;//360浏览器
if(!is360se) {
document.getElementById("FlexManyShips_ie").style.height=haituhigh+ "px";
document.getElementById("FlexManyShips_ie").style.width=width+ "px";
} else {
document.getElementById("FlexManyShips_ie").height = haituhigh+ "px";
document.getElementById("FlexManyShips_ie").width = width+ "px";
}
} else {
document.getElementById("FlexManyShips").style.height = haituhigh + "px";
document.getElementById("FlexManyShips").style.width = width + "px";
}
}
1.3 html代码:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="100%" height="100%" title="CJonline" id="FlexManyShips_ie"
name="FlexManyShips_ie">
<param name="src" value="flash/FlexManyShips.swf">
<param name="wmode" value="opaque">
<embed name="FlexManyShips" id="FlexManyShips" src="flash/FlexManyShips.swf"
quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="100%" height="100%" >
<param name="wmode" value="opaque">
</embed>
</object>