public string OpenModalDialog( Page refPage, int DialogHeight, int DialogWidth, string PageUrl, string PageName )
{
string vReturnValue = "";
StringBuilder OpenModalDialogScript = new StringBuilder();
OpenModalDialogScript.Append( "<script language=javascript>\n" );
OpenModalDialogScript.Append( "vReturnValue=window.showModalDialog('"+PageUrl+"','_blank','"+PageName+"','dialogHeight: "+DialogHeight+"px; dialogWidth: "+DialogWidth+"px; dialogTop: 150px; dialogLeft: 150px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;');" + "\n");
OpenModalDialogScript.Append( "</script>" );
refPage.RegisterStartupScript( "MsgBox", OpenModalDialogScript.ToString() );
return vReturnValue;
}
{
string vReturnValue = "";
StringBuilder OpenModalDialogScript = new StringBuilder();
OpenModalDialogScript.Append( "<script language=javascript>\n" );
OpenModalDialogScript.Append( "vReturnValue=window.showModalDialog('"+PageUrl+"','_blank','"+PageName+"','dialogHeight: "+DialogHeight+"px; dialogWidth: "+DialogWidth+"px; dialogTop: 150px; dialogLeft: 150px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;');" + "\n");
OpenModalDialogScript.Append( "</script>" );
refPage.RegisterStartupScript( "MsgBox", OpenModalDialogScript.ToString() );
return vReturnValue;
}
<input type="button" name="Submit" onclick="window.showModalDialog'login.asp','','width=270,height=150,top=200,left=300');window.close();,'','dialogWidth:0px;dialogHeight:0px');" value="Submit">
</form>
试试,你原来的写法很奇怪呀,showmodaldialog里又用window.open,不知是何意