开发者

Resizing an IE's window given dimensions of renderable space

开发者 https://www.devze.com 2023-01-11 14:22 出处:网络
I\'m looking to write a function which resizes an IE {7,8,9} window using javascript. The input to the function is the desired size of the rendered webpage (so IE\'s window without status bar, borders

I'm looking to write a function which resizes an IE {7,8,9} window using javascript. The input to the function is the desired size of the rendered webpage (so IE's window without status bar, borders, scrollbars, etc.

Calling foo(120,开发者_C百科 100) should result in a rendered web page which is exactly 120px by 100px.

This was my first effort:

function foo(x,y) 
{
    window.resizeBy( x - window.document.body.clientWidth, y - window.document.body.clientHeight );
}

This works reliabily for the x dimension, but not the y dimension. What is going wrong here and how do I fix it?


window.resizeBy( x - window.documentElement.offsetWidth, y - window.documentElement.offsetHeight );

0

精彩评论

暂无评论...
验证码 换一张
取 消