如何定制弹出窗口的大小及其位置

 弹出窗口本不属于ASP,不过javascript与ASP还是有点亲戚关系。
一、最简单的自动弹出窗口
在主窗口A中加入以下代码:
<SCRIPT LANGUAGE="javascript">
window.open ("页面B地址","newwindow", "height=450, width=520, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")
</SCRIPT>
打开A时就会自动弹出页面B

二、定义调用弹出窗口
在页面中加入以下代码:
<SCRIPT language=javascript>
<!--
function call(htmlurl){
var
newwin=window.open(htmlurl,"newsssWin","top=50,left=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=300");
newwin.focus();
return false;
}
//-->
</SCRIPT>

用下面的方法调用:
<a href=/'连接地址/' οnclick=/'return call(this.href);/' target=_blank>连接名称</a>


点击“连接地址”就会弹出播放的小窗口。

三、能自动关闭的弹出窗口
在主窗口A中加入以下代码:
<SCRIPT LANGUAGE="javascript">
window.open ("b.htm","newwindow", "height=450, width=520, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")
</SCRIPT>

页面b的代码如下:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body οnlοad="window.setTimeout(/'CloseWindow.Click()/',2000)">
<div align="center">
<p> </p><p><object id="CloseWindow" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <param name="Command" value="Close">
  </object> <font size="5" color="#FF0000"><b>欢迎光临<br><br>再见!</b></font><font size="5">
  </font></p>
</div>
</body>
</html>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值