1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
addMyEventListener(window, "resize", resizeSpApplet);
resizeSpApplet();
function addMyEventListener(target, type, listener)
{
if (target.addEventListener)
{
// standard DOM
target.addEventListener(type, listener, false);
}
else
{
// IE
target.attachEvent('on' + type, listener);
}
}
function resizeSpApplet()
{
var winW = 0;
var winH = 0;
if( typeof( window.innerWidth ) == 'number' )
{
//Non-IE
winW = window.innerWidth;
winH = window.innerHeight;
}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
{
//IE 6+ in 'standards compliant mode'
winW = document.documentElement.clientWidth;
winH = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
{
//IE 4 compatible
winW = document.body.clientWidth;
winH = document.body.clientHeight;
}
document.getElementById("spApplet").width = winW-60;
document.getElementById("spApplet").height = winH-200;
} |