I am attempting to automatically select an option from a javascript generated dropdown box upon returning to the page from error. I am passing javascript an ASP sessioned variable to perform the check.
When I check the one value against the other, I get a true, and my code should execute properly, but for some reason, enclosing the "selected" statement inside the "if" causes the statement to break.
Code follows:
Can anyone tell me why the myEle.selected craps out? Any help would be greatly appreciated!
EndEffect
When I check the one value against the other, I get a true, and my code should execute properly, but for some reason, enclosing the "selected" statement inside the "if" causes the statement to break.
Code follows:
Code:
for ( x = 0 ; x < ProdArrayCnt + 1 ; x++ ) {
myEle = document.createElement("option");
myEle.value = JSArrayProd[x][1];
myEle.text = JSArrayProd[x][2];
testvalue1 = JSArrayProd[x][1];
testvalue2 = '<%= Session("prodbox") %>';
if (testvalue1 == testvalue2){
myEle.selected = true;
}
myEle.style.background = '#bfd8df';
masterform.prodbox.add(myEle);
}
EndEffect