window.open('Default2.aspx','信息窗口','height=480, width=405, top=0,left=225,toolbar=no,menubar=no,scrollbars=yes,alwaysRaised=yes, resizable=no,location=no,status=no,dependent=yes')
现在我想打开一个窗口,该窗口要像模式窗口一样,这个窗口不关闭,无法点击父窗体上的内容,窗口要居中显示。请教各位我上面写的代码错在哪里
调试欢乐多
var left = (window.screen.width-width)/2;
居中显示
Winopen 使用说明:弹出页必须加<base target="_self">,否则提交时会弹出新窗口
最好也加入:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
否则页面被缓存会造成更改页面后不能显示为最新的
Parameter详解:
1. dialogHeight: 对话框高度,不小于100px
2. dialogWidth: 对话框宽度。
3. dialogLeft: 离屏幕左的距离。
4. dialogTop: 离屏幕上的距离。
5. center: { yes | no | 1 | 0 } : 是否居中,默认yes,但仍可以指定高度和宽度。
6. help: {yes | no | 1 | 0 }: 是否显示帮助按钮,默认yes。
7. resizable: {yes | no | 1 | 0 } [IE5+]: 是否可被改变大小。默认no。
8. status:{yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
9. scroll:{ yes | no | 1 | 0 | on | off }:是否显示滚动条。默认为yes。
示例:WinOpen('test.html','test','dialogHeight:300px;dialogWidth:200px;help:no;status:no;')
*/
function Winopen(PageUrl,title,parameter)
{
var sRet = window.showModalDialog(PageUrl,title,parameter);
if(sRet == "refresh")
{window.location.reload();}
}
var top = (screen.height -480)/2;
window.open('Default2.aspx','信息窗口','height=480,width=405,top='+ top +', left='+left+', toolbar=no,menubar=no,scrollbars=yes,alwaysRaised=yes, resizable=no,location=no,status=no,dependent=yes')
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
/*
Winopen 使用说明:弹出页必须加<base target="_self">,否则提交时会弹出新窗口
最好也加入:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
否则页面被缓存会造成更改页面后不能显示为最新的
Parameter详解:
1. dialogHeight: 对话框高度,不小于100px
2. dialogWidth: 对话框宽度。
3. dialogLeft: 离屏幕左的距离。
4. dialogTop: 离屏幕上的距离。
5. center: { yes | no | 1 | 0 } : 是否居中,默认yes,但仍可以指定高度和宽度。
6. help: {yes | no | 1 | 0 }: 是否显示帮助按钮,默认yes。
7. resizable: {yes | no | 1 | 0 } [IE5+]: 是否可被改变大小。默认no。
8. status:{yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
9. scroll:{ yes | no | 1 | 0 | on | off }:是否显示滚动条。默认为yes。
示例:WinOpen('test.html','test','dialogHeight:300px;dialogWidth:200px;help:no;status:no;')
*/
function Winopen(PageUrl,title,parameter)
{
var sRet = window.showModalDialog(PageUrl,title,parameter);
if(sRet == "refresh")
{window.location.reload();}
}</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body><input type="button" onclick="Winopen('http://www.baidu.com','title','dialogHeight:500px;dialogWidth:450px;edge:Raised;status:no;scroll:Yes;');" value="test" /></body>
</html>测试没问题。
LZ不考虑我的代码么。。我一直是用这个的。。
哥们。我这里不能用showModalDialog。。
div的样式
.d{
position:absolute;
z-index:3;
top:0px;
left:0px;
width:300px;
height:400px;
}