WebApp匯入資料之對話框實現——showModalDialog
1、應用場景
我常用的場景,列表的內容過多,dropdownlist顯示不便。例如:
2 <BODY>
3 <INPUT TYPE="text" NAME="name"><INPUT TYPE="button" VALUE="..." ONCLICK="">
4 </BODY>
5 </HTML>
2、預備知識要點
window.showModalDialog
Syntax
vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
Parameters
sURL Required. String that specifies the URL of the document to load and display.
vArguments Optional.
sFeatures Optional. String
dialogHeight:sHeight;dialogLeft:sXPos;dialogTop:sYPos;dialogWidth:sWidth;
center:{ yes | no | 1 | 0 | on | off };dialogHide:{ yes | no | 1 | 0 | on | off };
edge:{ sunken | raised };help:{ yes | no | 1 | 0 | on | off };
resizable:{ yes | no | 1 | 0 | on | off };scroll:{ yes | no | 1 | 0 | on | off };
status:{ yes | no | 1 | 0 | on | off };unadorned:{ yes | no | 1 | 0 | on | off }
e.g.: window.showModalDialog("SMD_target.htm","Dialog Arguments Value","dialogHeight: 73px; dialogWidth: 705px;
dialogTop: 578px; dialogLeft: 531px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
Return Value
Variant. Returns the value of the returnValue property as set by the window of the document specified in sURL .
a.Syntax
window.returnValue [ = vValue ]
3、實現要點
a,打開靜態頁面
打開Dialog
HTML Code
var ret=window.showModalDialog("DialogUrl.htm","","");
}
返回值
HTML Code
window.returnValue="returnvalue-test";
}
b,打開動態頁面
HTML Code
var ret=window.showModalDialog("DialogUrl.aspx","","");
}
返回值
VB Code
Page.ClientScript.RegisterStartupScript(Me.GetType(), "WinRet", s, True)
End Sub