弹出窗口本不属于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> |
如何定制弹出窗口的大小及其位置
最新推荐文章于 2023-12-23 15:09:20 发布