function OpenAWindow()
{
var strNewWindowStyle,intNewWindowHeight,intNewWindowWidth;
intNewWindowHeight = 220;
intNewWindowWidth = 400;
strNewWindowStyle = "Height=" + intNewWindowHeight.toString()+",";
strNewWindowStyle = strNewWindowStyle + "Width=" + intNewWindowWidth.toString()+",";
strNewWindowStyle = strNewWindowStyle + "Top=" + ((window.screen.height - intNewWindowHeight)/2).toString()+",";
strNewWindowStyle = strNewWindowStyle + "Left=" + ((window.screen.width - intNewWindowWidth )/2).toString();
showTeam.style.display ="none";
newWindow = window.open("aaa.aspx?m=123","aaa",strNewWindowStyle);
}
{
var strNewWindowStyle,intNewWindowHeight,intNewWindowWidth;
intNewWindowHeight = 220;
intNewWindowWidth = 400;
strNewWindowStyle = "Height=" + intNewWindowHeight.toString()+",";
strNewWindowStyle = strNewWindowStyle + "Width=" + intNewWindowWidth.toString()+",";
strNewWindowStyle = strNewWindowStyle + "Top=" + ((window.screen.height - intNewWindowHeight)/2).toString()+",";
strNewWindowStyle = strNewWindowStyle + "Left=" + ((window.screen.width - intNewWindowWidth )/2).toString();
showTeam.style.display ="none";
newWindow = window.open("aaa.aspx?m=123","aaa",strNewWindowStyle);
}
然后加上楼上的js函数即可
showModalDialog()是不能够提交给自己的,得交给自己的话就会有新页面产生,所以你要指写form里的target等于一个值。showModalDialog()里:
<form target=meizz action=aa.asp ...>在主页面里加一个隐藏的iframe浮动框架:
<iframe name=meizz width=0 height=0 frameborder=0 style="display: none"><iframe>
这样提交就不会有新的页面产生了。
JavaScript支持几种内建的对话框:window.alert()、window.confirm()以及window.prompt()。当弹出一个对话框时,用户就不可以再聚焦到初始页面,除非对话框操作结束。换言之,对话框永远是被聚焦的。Internet Explorer支持一些方法,使用它们能让你在任何新窗口上应用它们: showModalDialog() (Internet Explorer 4 和以上版本) showModelessDialog() (Internet Explorer 5 和以上版本) 以下是这些方法的语法: vReturnValue = window.showModalDialog(sURL[, vArguments][, sFeatures]); vReturnValue = window.showModelessDialog(sURL[, vArguments][, sFeatures]); 第1个参数是一个字符串,它指定了在新窗口中装载并显示的文档URL。第2个参数,vArguments,是一个variant,它指定了显示文档的命令。使用这个参数时,可以传递任意类型的数组或者数值。对话框能够从window对象的dialogArguments属性中将数值传递给调用者。 当通过其中一个方法打开一个新窗口时,新窗口(对话框)的window对象特写了dialogArguments属性,它包含了分配给调用方法的vArguments参数的数值。来看看下面的语句: window.showModalDialog("modalurl.html", window); 注意,第2个命令参数实际上是当前浏览器窗口的window对象。下面是文件modalurl.html的代码: <HTML> <HEAD> <TITLE>Change the URL</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function load(menu) { if (window.dialogArguments && dialogArguments.location) { dialogArguments.location.href = menu.options[menu.selectedIndex].value; window.close(); } } // --> </SCRIPT> </HEAD> <BODY> Pick your favorite investment site:<P> <FORM><SELECT NAME="menu"> <OPTION VALUE="http://www.fool.com/">Fool.com (The Motley Fool) <OPTION VALUE="http://www.investor.com/">MoneyCentral Investor <OPTION VALUE="http://www.thestreet.com/">TheStreet.com </SELECT> <INPUT TYPE="button" VALUE="Load" onClick="load(this.form.menu)"></FORM> </BODY> </HTML>
showModalDialog() 和 showModelessDialog() 方法并非被所有支持JavaScript的浏览器所支持。在调用任何一个方法之前,我们必须确认它们的有效性: if (window.showModalDialog) { ... } if (window.showModelessDialog) { ... } 如果用户的浏览器不能支持需要的方法,你也许希望考虑一个可供选择的行为,这可以通过调用window.open()方法来实现: if (window.showModalDialog) { win = window.showModalDialog("mydialog.html", ...); } else { win = window.open("mydialog.html", ...); } 一个交叉浏览器Modal对话框
RegisterStartupScript("key", "<script>window.opener=null;window.close(this);</script>")