你好我正在使用這個Page.ClientScript.RegisterStartupScript()來調用背後的VB代碼的JavaScript函數,這與我工作正常我的問題是我怎樣才能發送變量從背後這裏的JavaScript函數的代碼是我到目前爲止已經試過:從VB函數傳遞變量到客戶端javascript
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.LoadComplete
Dim Myname As String = "myName"
Dim cstype As Type = Me.GetType()
Page.ClientScript.RegisterStartupScript(cstype, "MyKey", "hello(Myname);",
True)
End Sub
的javascript:
<script type="text/javascript">
function hello(name) {
alert("hello world from javascript " + name)
}
</script>
謝謝...
謝謝這個作品完美 –