Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can JavaScript use arrays created in VBScript? 1

Status
Not open for further replies.

MikeT

IS-IT--Management
Feb 1, 2001
376
US
I created an array using vb.
Now I need to write a javascript func that uses this array.
Am I too much of an optimist?
Will java "see" and "understand" this array?
 
Did you create it client side or server side?
 
Server side; I have a small chunk of code on a separate page that I use as an #INCLUDE because multiple pages use it. I was able to access the array via VBScript on the page with the java function on it, so I know the array is there and readable(by vb anyway).
I could make this include as a javascript, but I don't know how. The elements of the array come from a database.
 
No problem if it's in server side code --

Go read the FAQ that Swany and I wrote on communicating between server & client side code, but the basic syntax would be this:

<%
'your array is already made and is called myArray
dim j
j = 1
%>
<script language=javascript>
function makeArray(){
var theArray[5];
var i
for (i = 1; i <= 5; i++){
theArray=<%
response.write(myArray(j))
j = j + 1%>;
}
}
</script>

so you see how they are operating independent of each other, but the server side code is writing the contents of its array to the screen while the javascript is assigning those values to the elements of its array.

hope it helps! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top