Forum Moderators: open
All the JS does is go to a location via a drop-down list box. Eg.
<form>
<select NAME="site" onChange="javascript:formHandler(this)">
<option SELECTED VALUE="">Select Page...</option>
<option VALUE="http://www.example.com.au/">Home</option>
<option VALUE="http://www.example.com.au/page2.html">Page 2</option>
<option VALUE="http://www.example.com.au/page3.html">Page 3</option>
</select>
</form>
The site did have the following on every page head:
<script LANGUAGE="JavaScript">
function formHandler(form){
var URL = document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
</SCRIPT>
This worked fine.
Now my js is linked from the page head using:
<script type="text/javascript" language="JavaScript" src="../js/javascript.js">
</script>
The error given by Mozilla javascript: command is this:
Error: document.form has no properties
Source File: file:///(location)/js/javascript.js
Line: 2
Any ideas?
BUT
A reference to the form (this) is being passed by the onChange event. You can see that where it says onChange="javascript:formHandler(this)".
It is accepted by the function with the name form. You can see that where it says function formHandler(form){.
Therefore you don't need document.form, you just need form.