0

我有一个确认框。如果用户单击框上的确定,我想调用一个函数。代码如下。

Dim message As String = " An Assessment for this date already exists. To create another one for this date click OK OR else click CANCEL to go back to Assessment History. "
Dim sb As New System.Text.StringBuilder()
sb.Append("<script type = 'text/javascript'>")
sb.Append("window.onload=function(){")
sb.Append("if (confirm('")
sb.Append(message)

sb.Append("')){ ") 

sb.Append("}")
sb.Append("else{")
sb.Append("window.location = 'SA.aspx?PID=" & Request("PID") & "';")
sb.Append("}};</script>")
ClientScript.RegisterClientScriptBlock(Me.GetType(), "confirm", sb.ToString())
4

1 回答 1

0
...
sb.Append("')){ ") 
sb.Append("yourFunction();") 
...

(当然,前提是您谈论的是 JavaScript 函数。)

于 2013-02-21T23:00:54.853 回答