[thelist] How can I pass a HTML "array" over to Javascript
Stefan Schwarzer
st.schwarzer at geois.de
Thu Aug 24 08:41:20 CDT 2006
Hi there,
I have a kind of HTML array ("layer[]"), which appears a couple of
times on my form. It is used so that a user can select multiple
layers to be displayed on a map. So, this would be "cities",
"national boundaries", "lakes", "rivers", etc.
It works fine. No problem with that.
Now, I would like, before passing the elements over to PHP, to do a
quick check with Javascript which layers have been selected, in order
to eliminate eventually one or to add another.
My function to do this looks like this:
function change_level()
{
lyr = new Array();
lyr = document.mapserv.layer;
for (i=0; i<lyr.length; i++)
{
if (lyr[i] = "cities")
... eliminate that layer
}
}
So, here I have a (actually two) problems. One is that I have no clue
how the HTML element "layer" can be passed over to a Javascript-
variable. And second I don't know how I can eliminate one element of
that array.
There probably would be some possibility to get the checking done in
PHP too, but the whole process behind the site is somewhat complex.
So it would come in very handy, if this would be achievable through
Javascript.
Can anyone help me out?
Thanks a lot!!
Stefan
More information about the thelist
mailing list