第一步:把如下代码加入到<head>区域中
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popupPage(l, t, w, h) {
var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes" +
",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
var URL = "link.htm";
popup = window.open(URL,"MenuPopup",windowprops);
}
// End -->
</script>
第二步:把如下代码加入到<body>区域中
<center>
<table>
<tr>
<td>
<form name=popupform>
<pre>自己设定弹出窗口的大小及位置<br>
左边距: <input type=text name=left size=2 maxlength=4> 象素
石边距: <input type=text name=top size=2 maxlength=4> 象素
窗口宽: <input type=text name=width size=2 maxlength=4> 象素
窗口高: <input type=text name=height size=2 maxlength=4> 象素
</pre>
<center>
<input type=button value="打开窗口" onClick="popupPage(this.form.left.value, this.form.top.value, this.form.width.value, this.form.height.value)">
</center>
</form>
</td>
</tr>
</table>
</center>
另
<input type=button onclick="PopWindow()" id="PopButton">
<script>
function PopWindow()
{
window.open("about:blank","","top="+GetDefineY(PopButton)+" left="+GetDefineX(PopButton)+" width=100 height=100");
}
function GetDefineX(ObjectID)
{
var iPositionX=ObjectID.offsetLeft;
while(ObjectID=ObjectID.offsetParent)
{
iPositionX+=ObjectID.offsetLeft;
}
return iPositionX;
}
function GetDefineY(ObjectID)
{
var iPositionY=ObjectID.offsetTop;
while(ObjectID=ObjectID.offsetParent)
{
iPositionY+=ObjectID.offsetTop;
}
return iPositionY;
}
</script>
×××××××××××××××××××××××××××××××××××××××××××
或者
<body onLoad="MM_openBrWindow('pop.asp','短消息','scrollbars=yes,resizable=yes,width=250,height=342,left=100,top=100')">
修改left和top为你想要的位置即可!
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popupPage(l, t, w, h) {
var windowprops = "location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes" +
",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
var URL = "link.htm";
popup = window.open(URL,"MenuPopup",windowprops);
}
// End -->
</script>
第二步:把如下代码加入到<body>区域中
<center>
<table>
<tr>
<td>
<form name=popupform>
<pre>自己设定弹出窗口的大小及位置<br>
左边距: <input type=text name=left size=2 maxlength=4> 象素
石边距: <input type=text name=top size=2 maxlength=4> 象素
窗口宽: <input type=text name=width size=2 maxlength=4> 象素
窗口高: <input type=text name=height size=2 maxlength=4> 象素
</pre>
<center>
<input type=button value="打开窗口" onClick="popupPage(this.form.left.value, this.form.top.value, this.form.width.value, this.form.height.value)">
</center>
</form>
</td>
</tr>
</table>
</center>
另
<input type=button onclick="PopWindow()" id="PopButton">
<script>
function PopWindow()
{
window.open("about:blank","","top="+GetDefineY(PopButton)+" left="+GetDefineX(PopButton)+" width=100 height=100");
}
function GetDefineX(ObjectID)
{
var iPositionX=ObjectID.offsetLeft;
while(ObjectID=ObjectID.offsetParent)
{
iPositionX+=ObjectID.offsetLeft;
}
return iPositionX;
}
function GetDefineY(ObjectID)
{
var iPositionY=ObjectID.offsetTop;
while(ObjectID=ObjectID.offsetParent)
{
iPositionY+=ObjectID.offsetTop;
}
return iPositionY;
}
</script>
×××××××××××××××××××××××××××××××××××××××××××
或者
<body onLoad="MM_openBrWindow('pop.asp','短消息','scrollbars=yes,resizable=yes,width=250,height=342,left=100,top=100')">
修改left和top为你想要的位置即可!