VBScript to JavaScript Arrays

I load an array in vbscript with items from a db then want to pass the array to a javascript function.  Can anyone give me an example of this?
dmfttmAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
I assume you are using .ASP

First, you must convert the vb array to a js array:

<SCRIPT language='javascript'>

 var myjsarray = new Array();

<%
      Dim i=0
      for each item in theVBarray
         response.write "myjsarray[" & i & "] = " & item & ";" & vbCrLf
         i = i + 1
%>

// then the array can be passed to a js function

myfunction(myjsarray);

</script>

The code above is not perfect, but you get the idea.
0
 
dmfttmAuthor Commented:
Thanks!!!!!!!!
0
All Courses

From novice to tech pro — start learning today.