server side javascript array

J

jvcoach23

I am trying to load an array on the load of a page to javascript. the
script will eventually have parts being loaded from a database... this is
just a first step to get there... Here is the code

Dim mScript As New System.Text.StringBuilder
mScript = mScript.Append("<script type='text/javascript'>" & vbNewLine)

mScript.Append("var mIconAry = new Array();" & vbNewLine)
mScript.Append("mIconAry[" & 0 & "]='" &
"http://maps.google.com/mapfiles/ms/icons/purple-pushpin.png" & "';" &
vbNewLine)
mScript.Append("mIconAry[" & 1 & "]='" &
"http://maps.google.com/mapfiles/ms/icons/green-pushpin.png" & "';" &
vbNewLine)

'mScript.Append("var mInfoBox = new Array();" & vbNewLine)
'mscript.Append("mInfoBox[" & 0 & "]='" &

mScript.Append("</script>")
RegisterStartupScript("RegisterClientScriptBlock", mScript.ToString())

when i run this.. the javascript isn't there. I've tried looking using
firefox and a plugin that allows you to see all the javascript and it's not
there.. i'm using the same technique as i've used on another page and it
works there.. i don't think i've left anything out.

I'd like to use this array to put pushpins onto a microsoft virutal earth
map that i'm using. anyway.. anyone have any idea's what i'm doing wrong
in my code above.

thanks
shannon
 
J

jvcoach23

Thanks
in doing a little searching... i see this

RegisterArrayDeclaration("TextBoxes","TextBox1")
RegisterArrayDeclaration("TextBoxes", "TextBox2")

and they say that it will produce

<script language="javascript" >
<!--
var TextBoxes = new Array(TextBox1, TextBox2);
// -->
</script>

is it as simple as that to get the array in there... i've tried it.. the
array is not showing up in the javascript.. so i'm just curious if what
i've read is incorrect.
thanks
 
B

bruce barker

the non-woprking page probably does a redirect, so none of its html is of any
use.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top