I call a function in my .js file like this:
onClick="locati on.href='blank. html' +
generateSearchS tringFromForm(' section')"
where section is the name of my form.
The function is defined as follows:
myFunction(k) {
for (var i=0; i < document.forms[k].elements.lengt h; i++) {
element = document.forms[k].elements[i];
//do stuff with each element
}
}
The problem is I'm getting the following error -
Error: Object expected
Code: 0
Surely the above code is OK?
I seem to get this error alot, even though it appears to work sometimes with
no complaint.
If there is an error in the code of another function in the same .js page
would this cause the call to this particular function to return such an
error?
onClick="locati on.href='blank. html' +
generateSearchS tringFromForm(' section')"
where section is the name of my form.
The function is defined as follows:
myFunction(k) {
for (var i=0; i < document.forms[k].elements.lengt h; i++) {
element = document.forms[k].elements[i];
//do stuff with each element
}
}
The problem is I'm getting the following error -
Error: Object expected
Code: 0
Surely the above code is OK?
I seem to get this error alot, even though it appears to work sometimes with
no complaint.
If there is an error in the code of another function in the same .js page
would this cause the call to this particular function to return such an
error?
Comment