I have this form in my site that uses JavaScript to clear the fields when clicked on (highlighted) and also checks to see if all the fields have been filled in. I've used this code for other sites and it works fine. I can't figure out why it doesn't work now! Everything is the same from the previous code!
+2
A:
The problem is that the function addLoadEvent
is used before it is defined. Try switching the order of your JavaScript files.
<script type="text/javascript" src="j/global.js"></script>
<script type="text/javascript" src="j/contact.js"></script>
The following code in contact.js
currently fails to execute:
addLoadEvent(focusLabels);
addLoadEvent(prepareForms);
Due to the fact that you're loading contact.js
before global.js
, where addLoadEvent
is defined.
Zack Mulgrew
2009-08-12 01:16:32
Sometimes the simple explanation is the least obvious!! Thanks for your help.
2009-08-13 13:08:05