我的代码如下
Public cs As ClientScriptManager
Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cs = Page.ClientScript
cs.RegisterArrayDeclaration("activArray", """asd"",""ert"",""sdt""")
End Sub
//"text/javascript"
function doInit() {
alert(activArray.length)
}
在运行这些代码时,它显示错误 Microsoft JScript运行时错误:'activArray'未定义
请帮我解决这个错误。谢谢你
答案 0 :(得分:-2)
只需使用\
来转义数组字符串,如:
cs.RegisterArrayDeclaration("activArray", "\"asd\","\"ert\","\"sdt\"")