开发者

Resizing an IE's window given dimensions of renderable space

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜