D
DrKen
I'm trying to understand some JavaScript that I have to maintain and
in looking at one bit, I'm trying to validate that I understand it,
but I have not been able through a Google search to find an
explanation of this syntax. I'm wondering in fact if it is from a
JavaScript library of some kind. I am not incliuding the whole array
but this should be sufficient:
var locations = $("#field-location select:first option");
var loc = new Array();
loc["az"] = { value: "AZ", caption: "Azusa" };
loc["co"] = { value: "CO", caption: "Colorado Springs" };
loc["hd"] = { value: "VI", caption: "High Desert Regional Center" };
loc["ie"] = { value: "IE", caption: "Inland Empire Regional Center" };
loc["in"] = { value: "IN", caption: "International" };
loc["la"] = { value: "LA", caption: "Los Angeles Regional Center" };
loc["mu"] = { value: "MU", caption: "Murrieta Regional Center" };
The array values are used later in the .js file so that when a user
clicks on one select and makes a choice, another box shows one or more
of these locations that are specific to it. That has always worked
fine. What I want to know, to be very specific is, if a user selects
the choice "High Desert" (hd), the result will be that the select will
return "VI" as the value that should go back to ther server? Thanks.
Ken
in looking at one bit, I'm trying to validate that I understand it,
but I have not been able through a Google search to find an
explanation of this syntax. I'm wondering in fact if it is from a
JavaScript library of some kind. I am not incliuding the whole array
but this should be sufficient:
var locations = $("#field-location select:first option");
var loc = new Array();
loc["az"] = { value: "AZ", caption: "Azusa" };
loc["co"] = { value: "CO", caption: "Colorado Springs" };
loc["hd"] = { value: "VI", caption: "High Desert Regional Center" };
loc["ie"] = { value: "IE", caption: "Inland Empire Regional Center" };
loc["in"] = { value: "IN", caption: "International" };
loc["la"] = { value: "LA", caption: "Los Angeles Regional Center" };
loc["mu"] = { value: "MU", caption: "Murrieta Regional Center" };
The array values are used later in the .js file so that when a user
clicks on one select and makes a choice, another box shows one or more
of these locations that are specific to it. That has always worked
fine. What I want to know, to be very specific is, if a user selects
the choice "High Desert" (hd), the result will be that the select will
return "VI" as the value that should go back to ther server? Thanks.
Ken