我有一个确认框。如果用户在框中单击“确定”,我想调用一个函数。代码如下。
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())
答案 0 :(得分:0)
...
sb.Append("')){ ")
sb.Append("yourFunction();")
...
(当然,如果您正在谈论JavaScript功能。)