1

我有如下代码

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 runtime error: 'activArray' is undefined

请帮我解决这个错误。谢谢

4

1 回答 1

-2

只需使用\转义数组字符串,如:

cs.RegisterArrayDeclaration("activArray", "\"asd\","\"ert\","\"sdt\"")
于 2012-09-19T09:15:05.507 回答