[英]Calling JavaScript function in If-Else Statement
VB.Net:
Protected Sub btnFinish_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFinish.Click
For a As Integer = 0 To grdQ.Rows.Count - 1 Step a + 1
Dim an As TextBox = DirectCast(Me.grdQ.Rows(a).FindControl("txtAnswer"), TextBox)
If an.Text = String.Empty Then
'do something
Exit For
ElseIf an.Text <> "" Then
ScriptManager.RegisterClientScriptBlock(Page, Me.GetType(), "Script", "finAns();", True)
End If
Next
End Sub
..JavaScript:
<script type='text/javascript'>
function finAns() {
$("#timeLeft").dialog({
title: "There's Still Time Left!",
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();
},
modal: true,
draggable: false,
resizable: false
});
return false;
}
</script>
這些代碼有什么問題? 似乎不起作用。 調用javascript函數無法正常工作。我對javascript不太滿意,這就是為什么我需要一些幫助。 感謝:D
嘗試
Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","finAns()",true)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.