首页 >> 文档 >> JavaScript专题

根据指定的宽度和高度改变窗口大小:resizeTo

发布日期:2009-03-18最近更新:2009-03-18来源:BHCODE作者:

语法:
window . resizeTo ( iWidth , iHeight )


参数:
iWidth  :  必选项。整数(Integet)。指定窗口宽度。单位为像素( px )。
iHeight  :  必选项。整数(Integet)。指定窗口高度。单位为像素( px )。

说明:
根据指定的宽度和高度改变窗口尺寸。

示例代码:

<script>
var iToHeight=iToWidth=300;
var iFromHeight=210;var iFromWidth=240;
function rdl_doResize(){
if (iToHeight==iFromHeight && iToWidth==iFromWidth) return;
if (iFromHeight<iToHeight) iFromHeight++;else if (iFromHeight!=iToHeight) iFromHeight--;
if (iFromWidth<iToWidth) iFromWidth++;else if (iFromWidth!=iToWidth) iFromWidth--;
window.resizeTo(iFromWidth,iFromHeight);
window.setTimeout("rdl_doResize()",1);
}
</script>


<div>点击下面的按钮将改变窗口的尺寸。</div><br>
<input type=button value=" 改变尺寸 " onclick="rdl_doResize();">

本周推荐
MORE
热点关注
MORE