Hey guys.
So I've always had this question, just never got it answered or really attempted to figure it out.
I have global rollovers on my topnav, but I want the one for the certain page I'm on to stay in it's "over state".
I've usually just accomplished this by using event handlers in the html but I didn't want to do that this time around. I want to have all the script in the .js. I was trying to think of how to do it and the only way I really thought of was to give the body of the page an ID but then I'd have to do something (in laymans terms) like this, "if tagname body has the id of _____ then ignore ________ function or whatever. I'm sure this isn't the right way to do this.
Any help would be great, I'm pretty new to javascript.
Here's how I'm doing the rollovers at the moment:
Code:
home.onmouseover = function() {
home.src = "images/home-over.jpg";
}
home.onmouseout = function() {
home.src = "images/home.jpg";
}
A friend of mine showed me a better way to do it using e.targ, etc. but I'm not too familiar with it so didn't use it.
Thanks!!!
|