Compose JavaScript Array by VB array 
Author Message
 Compose JavaScript Array by VB array

Hello,

I am using VB script (ASP page) to get an array of data from database.
Now I need to manipulate the result data array on the browser side. Is
it possible to load the VB array to a JavaScript array on a ASP page?

Thank you very much for any suggestion.

-yuling

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Fri, 02 May 2003 03:00:00 GMT  
 Compose JavaScript Array by VB array

Hi

You can Response.Write it out as a client side array:

<script type="text/JavaScript">
<%
var cnt = 0;
var theData = "var myArray = new Array();";
  while( !rs.EOF )
          {
           theData += "myArray[" + cnt++ + "]=" + rs("ID").value + ";";
           theData += "myArray[" + cnt++ + "]='" + rs("sName").value + "';";
           rs.MoveNext();
          }
 Response.Write( theData );
%>

alert( myArray.length );

for(i = 0; i < myArray.length; i++)
    {
     document.write( myArray[ i ] )
    }
</script>

--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================

Quote:

> Hello,

> I am using VB script (ASP page) to get an array of data from database.
> Now I need to manipulate the result data array on the browser side. Is
> it possible to load the VB array to a JavaScript array on a ASP page?

> Thank you very much for any suggestion.

> -yuling

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Fri, 02 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. perl hash array/javascript arrays

2. VB array to Java Array

3. Convert multi-dimension vbscript array to javascript array

4. Returning arrays from VB/VC components or VBScript to JavaScript in ASP

5. wsh/ jscript : BUG : array of array, 2D array

6. VB array to JS array with XML: SAFE ARRAY?

7. Server Array to Client-Side Array

8. Help converting server-side VBScript array into client-side JScript array

9. Array size of a 2 dimensional array

10. Array of arrays with ASP

11. Passing Array to Session Variable Then back to Array

12. Server Array to Client-Side Array

 

 
Powered by phpBB® Forum Software