您好,我正在使用此 Page.ClientScript.RegisterStartupScript() 从后面的 vb 代码调用 javascript 函数,这对我来说很好 我的问题是如何将变量从后面的代码发送到 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>
谢谢 ...