WebApp匯入資料之對話框實現——showModalDialog
1、應用場景
我常用的場景,列表的內容過多,dropdownlist顯示不便。例如:

1 <HTML>
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

    function Button2_onclick() {
            
var ret=window.showModalDialog("DialogUrl.htm","","");
}

返回值
HTML Code

function Button1_onclick() {
    window.returnValue
="returnvalue-test";
}

b,打開動態頁面
HTML Code

function btnWithPostback_onclick() {
    
var ret=window.showModalDialog("DialogUrl.aspx","","");
}

返回值
VB Code

    Protected Sub btnPostback_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnPostback.Click        Dim s As String = _        "window.returnValue=""returnvalue-test"";"

        Page.ClientScript.RegisterStartupScript(
Me.GetType(), "WinRet", s, True)
    
End Sub

相关文章:

  • 2021-07-27
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2021-07-07
  • 2021-12-28
  • 2022-01-13
猜你喜欢
  • 2022-01-19
  • 2021-06-28
  • 2021-08-13
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
相关资源
相似解决方案