I have a problem that involves ASP and JavaScript so I am posting this in both places. I have a page that uses an array called by a function to populate a drop down in a form. Listed below are 1) the array, 2) the function calling, and 3) the function with the parameters.
I am modifying this (I did not write it) so that I can persist data as I move through a series of pages. The information is being stored in an ASP Session variable Session("State". How can I call the session variable to replace the 00,(Make Selection) in the array so it becomes the selected item when I return to the page so that the user does not loose the selection when they come back to the page? I know this is mostly a Javascript question but if any of you can provide assistance it would be greately appreciated.
1)
var StateArray = new Array();
StateArray[StateArray.length] = new SetCode("00", "(Make Selection)"
StateArray[StateArray.length] = new SetCode("AK", "Alaska"
StateArray[StateArray.length] = new SetCode("AL", "Alabama"
2)
function LoadCodes(ComboList, CodeArray)
{
for (i=0; i < CodeArray.length; i++)
{
ComboList.options = new Option(CodeArray.Description);
ComboList.options.value = CodeArray.Code;
}
ComboList.options[0].selected = true;
}
3)
function LoadBody()
{
LoadCodes(document.Pers.STATE, StateArray);
}
I am modifying this (I did not write it) so that I can persist data as I move through a series of pages. The information is being stored in an ASP Session variable Session("State". How can I call the session variable to replace the 00,(Make Selection) in the array so it becomes the selected item when I return to the page so that the user does not loose the selection when they come back to the page? I know this is mostly a Javascript question but if any of you can provide assistance it would be greately appreciated.
1)
var StateArray = new Array();
StateArray[StateArray.length] = new SetCode("00", "(Make Selection)"
StateArray[StateArray.length] = new SetCode("AK", "Alaska"
StateArray[StateArray.length] = new SetCode("AL", "Alabama"
2)
function LoadCodes(ComboList, CodeArray)
{
for (i=0; i < CodeArray.length; i++)
{
ComboList.options = new Option(CodeArray.Description);
ComboList.options.value = CodeArray.Code;
}
ComboList.options[0].selected = true;
}
3)
function LoadBody()
{
LoadCodes(document.Pers.STATE, StateArray);
}