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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot get Array data

Status
Not open for further replies.

rkmoray

Programmer
May 21, 2004
3
CA
I load an array using server side script off the db when the page opens.

do while not rs.eof
DealerArray(x)=rs("Dealername")
x=x+1
rs.movenext
loop

When I try to access the array therough a client side click event, I get an array error as if it was not initialized to begin with.

<SCRIPT LANGUAGE="VBScript">
Function GetDealer(mLetter)
msgbox DealerArray(1)
end Function
</script>
 
Hello rkmoray,

Not sure understand the setting you work on. I suppose the first part is server-side. Then may be something like this.
<%
'...other stuff
dim DealerArray()
redim DealerArray(rs.recordcount-1)
x=0
do while not rs.eof
DealerArray(x)=rs("Dealername")
x=x+1
rs.movenext
loop
' etc...
%>
The second part would be something like this.

Function GetDealer(mLetter)
msgbox <%=DealerArray(1)%>
end Function

regards - tsuji
 
I dont have a problem filling the array on the server side, just getting the array to be recognized on the client side.
Your solution will not work because the function is not in a client side script.
 
rkmoray,

Do you mean the function is on server-side? If yes, what is the deal using msgbox?

- tsuji
 
INstail gettng is on the server saide, that is what fills in the array, the function should be on the client side
 
Quick question, if you right-click on your page and view source, is the array you created there?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top