kateyez44
11-22-2002, 09:51 AM
Hi. I am pretty new to JavaScript and am having some difficulties. The project I'm working on incorporates code that was written by our client. The piece I'm having a problem with pre-populates a Select box on an ASP page with a list of months.
In some instances, one of the months in the select box will need to be pre-selected. This is where the problem lies. I cannot figure out how to get the Select box to pre-select anything. Here is the code I have been trying:
<!--
//this is the function that pre-populates the combo
document.write(populateMonths());
//this is where I'm trying to pre-select a specific value
document.frmClaimantDrug.lstEmpBeginM.SelectedIndex = "<%=intMonth%>"
//I have also tried:
document.frmClaimantDrug.lstEmpBeginM.Value = "<%strMonth%>"
// -->
The value for intMonth is obtained through a VBScript function I use in the ASP page. I have tested this and I know that this variable contains the correct value. Please tell me what I am doing wrong. This is driving me mad. Thank you.
In some instances, one of the months in the select box will need to be pre-selected. This is where the problem lies. I cannot figure out how to get the Select box to pre-select anything. Here is the code I have been trying:
<!--
//this is the function that pre-populates the combo
document.write(populateMonths());
//this is where I'm trying to pre-select a specific value
document.frmClaimantDrug.lstEmpBeginM.SelectedIndex = "<%=intMonth%>"
//I have also tried:
document.frmClaimantDrug.lstEmpBeginM.Value = "<%strMonth%>"
// -->
The value for intMonth is obtained through a VBScript function I use in the ASP page. I have tested this and I know that this variable contains the correct value. Please tell me what I am doing wrong. This is driving me mad. Thank you.