怎样获得通过window.open新开的窗口的长宽? width=screen.Width;height=screen.height 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 to youbest(冲天飞豹) :新窗口的长宽是在窗体里面resize的时候指定的,希望能在open的时候得到长宽的值。to zwztu() :你说的那个是屏幕的长宽,而不是窗口的 alert(hWind.document.body.clientWidth); alert(hWind.document.body.clientHeight); to sor(鬼梁):alert(hWind.document.body)------->null 測試通過,彈出200<input type=button value=open onclick="hWnd=open('1.htm','','width=200,height=200')"><input type=button value=getwidth onclick="alert(hWnd.document.body.clientWidth)"> 我是先hWind=window.open()以后才alert(hWind.document.body)的! var o = window.open('t2.htm',null ,'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');alert( o.window.document.body.clientWidth );alert( o.window.document.body.clientHeight ); 你就用下面这段代码:<script>a=window.open("about:blank");alert(a.window.document.body.clientWidth);</script> 个人建议还是使用函数传递的方式彻底解决这个问题…… 我试了一下sor(鬼梁)的方法,不知道为什么,第一次还能运行,从第二次开始就又是null了…… 新手,不知道为什么啊…… innerHTML有script,如转换呢? 怎么在extjs4中给grid加多个toolbar? 怎么不引起2次onchange事件 面向对象JS 为什么通过struts跳转,ext就获取不到数据 JS实选定当前行checkbox 如何用js动态改变影片播放的路径 求教滑动展开的DIV 事件返回false时,IE浏览器可以,FireFox浏览器不行. 求一菜单目录,我这有一份,是用javascript写的可是。。 请教用 vbs 或 js 如何获得 IE 状态栏的系统信息 各位帮一下忙~
to zwztu() :你说的那个是屏幕的长宽,而不是窗口的
alert(hWind.document.body.clientHeight);
<input type=button value=getwidth onclick="alert(hWnd.document.body.clientWidth)">
alert( o.window.document.body.clientWidth );
alert( o.window.document.body.clientHeight );
<script>
a=window.open("about:blank");
alert(a.window.document.body.clientWidth);
</script>