I have a VERY simple piece of JavaScript code that works in FireFox, but for some reason, does not work in IE or Netscape.
Here is the code, I will describe the problem below...
<script type="text/javascript">
function processOp(opFieldName, textFieldName)
{
var operatorSelect = document.forms[0].elements[opFieldName];
var textField = document.forms[0].elements[textFieldName];
alert(operatorSelect.selectedIndex); //*****
var operator = operatorSelect.options[operatorSelect.selectedIndex].value;
alert("Operator: " + operator); //*****
if (operator == "<%= Operator.BETWEEN.toString() %>")
{
textField.disabled=false;
}
else
{
textField.value="";
textField.disabled=true;
}
}
</script>
You can see where I added some debug output (indicated by trailing comments).
I am passing in the name of a text field and a select menu. The text field is supposed to be disabled/enabled based on the value in the select menu. This function is called when the select menu changes (onchange).
In IE and Netscape, the value of the "currently selected index" is always blank. However, the selected index number is correct, so I know that it is looking in the right spot.
In FireFox, everything works perfect.
Any ideas? Let me know if I didn't state the problem clear enough. Thanks everyone.
------
KJR
Here is the code, I will describe the problem below...
<script type="text/javascript">
function processOp(opFieldName, textFieldName)
{
var operatorSelect = document.forms[0].elements[opFieldName];
var textField = document.forms[0].elements[textFieldName];
alert(operatorSelect.selectedIndex); //*****
var operator = operatorSelect.options[operatorSelect.selectedIndex].value;
alert("Operator: " + operator); //*****
if (operator == "<%= Operator.BETWEEN.toString() %>")
{
textField.disabled=false;
}
else
{
textField.value="";
textField.disabled=true;
}
}
</script>
You can see where I added some debug output (indicated by trailing comments).
I am passing in the name of a text field and a select menu. The text field is supposed to be disabled/enabled based on the value in the select menu. This function is called when the select menu changes (onchange).
In IE and Netscape, the value of the "currently selected index" is always blank. However, the selected index number is correct, so I know that it is looking in the right spot.
In FireFox, everything works perfect.
Any ideas? Let me know if I didn't state the problem clear enough. Thanks everyone.
------
KJR