Hey all,
I'm not very proficient with javascript so I was wondering if someone could help me figure out why the following code works in IE, but not in Firefox.
The error i get is that "document.forms is not a function" - pointing to the 2nd line of the following...
function addSection() {
var theForm = document.forms(0);
if (theForm.queryValue.value == '')
alert("Please enter a query value.");
else if (theForm.queryField.options.length < 1)
alert("Please select an identifiable layer (Step 1)");
else {
var fieldName, fieldType, quoteString, tempIndex;
quoteString = '';
tempIndex = theForm.queryField.value.indexOf("|", 0);
fieldName = theForm.queryField.value.substring(tempIndex + 1);
fieldType = theForm.queryField.value.substring(0, tempIndex);
if (fieldType == 12) { quoteString = "\'"; }
addString(fieldName + theForm.queryOperator.value + quoteString + theForm.queryValue.value + quoteString);
theForm.queryValue.value = '';
}
Any thoughts?
Thanks!
I'm not very proficient with javascript so I was wondering if someone could help me figure out why the following code works in IE, but not in Firefox.
The error i get is that "document.forms is not a function" - pointing to the 2nd line of the following...
function addSection() {
var theForm = document.forms(0);
if (theForm.queryValue.value == '')
alert("Please enter a query value.");
else if (theForm.queryField.options.length < 1)
alert("Please select an identifiable layer (Step 1)");
else {
var fieldName, fieldType, quoteString, tempIndex;
quoteString = '';
tempIndex = theForm.queryField.value.indexOf("|", 0);
fieldName = theForm.queryField.value.substring(tempIndex + 1);
fieldType = theForm.queryField.value.substring(0, tempIndex);
if (fieldType == 12) { quoteString = "\'"; }
addString(fieldName + theForm.queryOperator.value + quoteString + theForm.queryValue.value + quoteString);
theForm.queryValue.value = '';
}
Any thoughts?
Thanks!