javascript help
- Started
- Last post
- 1 Response
- hans_glib
First off I should say I don't understand javascript at all. I took this code from a site which had a drop down menu I liked (forget which site it was) and deleted all the unnecessary other functions that the Firefox Error Console complained about, but it says:
"Error: navigation is not defined"
What needs doing to keep it happy?
<script type="text/javascript">
Event.observe(window,'load', function() {
navigation();
navigation = function() {
if(document.all&&document.getEle... {
$$("#navbar>ul>li").each(functio... {
li.onmouseover = function() {
li.addClassName('hover');
}
li.onmouseout = function() {
li.removeClassName('hover');
}
});
}};
// For consistency sake, add all the script.aculo.us effects
Effect = Object.extend({}, Effect);// Similar to Event.findElement
Object.extend(Element,{
findElement: function(element, tagName) {
var element = $(element);while (element.parentNode && (!element.tagName ||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;return $(element);
}
});});</script>
Any help much appreciated
- taxiguerrilla0
var navigation = function() {
[...]
}navigation();
try calling the function after the declaration and not before.