根据内容自动调整弹出窗口大小的JS解决方案
2007-07-25 21:57
453 查看
问题
在弹出创苦时,根据窗口的内容来自动调节窗口的大小,窗口如果已经和屏幕相等大小时则出现滚动条。
解决方案
在弹出的页面中添加一JS脚本方法win_onLoad(),在body的
部分代码如下:
<script language=javascript>
function win_onLoad(){
var width = document.all["tblKsList"].offsetWidth;
var height = document.all["tblKsList"].offsetHeight;
width = eval(width + 50);
height = eval(height + 50);
if (width < 500)
width = 500;
else if (width > screen.width)
width = screen.width;
if (height < 400)
height = 400;
else if (height > screen.height)
height = screen.height;
//alert(width);alert(height);
window.resizeTo(width,height);
}
</script>
<head></head>
<BODY bgcolor="0099CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
<TABLE width="95%" border="0" cellpadding="0" cellspacing="0" class="table-left1-right2" style="border:1 solid #000000" id="tblList">
<TR>
<TD width="100%" valign="top" colspan=2>
欢迎使用!
</TD>
</TR>
</TABLE>
</BODY>
在弹出创苦时,根据窗口的内容来自动调节窗口的大小,窗口如果已经和屏幕相等大小时则出现滚动条。
解决方案
在弹出的页面中添加一JS脚本方法win_onLoad(),在body的
部分代码如下:
<script language=javascript>
function win_onLoad(){
var width = document.all["tblKsList"].offsetWidth;
var height = document.all["tblKsList"].offsetHeight;
width = eval(width + 50);
height = eval(height + 50);
if (width < 500)
width = 500;
else if (width > screen.width)
width = screen.width;
if (height < 400)
height = 400;
else if (height > screen.height)
height = screen.height;
//alert(width);alert(height);
window.resizeTo(width,height);
}
</script>
<head></head>
<BODY bgcolor="0099CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
<TABLE width="95%" border="0" cellpadding="0" cellspacing="0" class="table-left1-right2" style="border:1 solid #000000" id="tblList">
<TR>
<TD width="100%" valign="top" colspan=2>
欢迎使用!
</TD>
</TR>
</TABLE>
</BODY>
相关文章推荐
- 根据内容自动调整弹出窗口大小的JS解决方案
- 根据内容自动调整弹出窗口大小的JS解决方案
- 根据内容自动调整弹出窗口大小的JS解决方案
- 弹出窗口根据内容自动调整大小的JS解决方案
- 根据内容自动调整弹出窗口大小的JS解决方案 选择自 WeekZero 的 Blog
- 根据内容自动调整弹出窗口大小的JS解决方案
- 根据内容自动调整弹出窗口大小的JS解决方案
- 根据内容自动调整弹出窗口大小的JS解决方案
- 弹出窗口根据内容调整大小并居中的JS实现(适用IE、活动窗口和模式窗口)
- window.onload and showModalDialog根据内容自动调整窗口大小
- showModalDialog根据内容自动调整窗口大小
- showModalDialog根据内容自动调整窗口大小
- java 添加背景图片(可根据窗口大小自动调整显示图片)
- QTableView根据内容自动调整大小(resizeColumnToContents解决不了的)
- 窗口根据屏幕分辨率自动调整大小
- AutoFitTextView-根据文本内容自动调整字体大小的TextView
- [JS]iframe根据子页面自动调整大小
- 把界面上静态文本控件的尺寸根据文本的内容自动调整大小(转)
- 把界面上静态文本控件的尺寸根据文本的内容自动调整大小(转)
- iframe自动根据内容调整大小