北京大学法学院杨楠楠:如何控制窗口大小及位置

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 20:56:18
请问如何设置一个窗口被访问时的大小及位置.
例如,<a href="aaa.html" target="_blank"><img src="aaa.gif"></a>
我想设置按aaa.gif访问aaa.html时,aaa.html的大小是300*300,并显示在屏幕正中间,不许拖动scroll.
谢谢!
不能用window.open,因为弹出窗口有可能被屏蔽.谢谢
谢谢li. 我用onclick调用showModalDialog(),这样应该不会被屏蔽吧?因为我要放在JS的document.write中,里面的""和''会混乱,所以只好用onclick.而且这语句只能在IE中运行,在FIREFOX就不行了,有什么办法可以让它在除IE外的其他浏览器中实现呢?谢谢!!!搞定的话我再加分!

用层或者用模态窗口

<a href=window.showModalDialog('aaa.html','esky','dialogWidth:300px;dialogHeight:300px;status=no')><img src="aaa.gif"></a>

function newwin() {
newwin=window.open("aaa.htm","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=530,height=400"); newwin.focus();
return false;
}
<a href="#" onClick="return newwin()">