你好我正在使用这个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>
谢谢...
谢谢这个作品完美 –