PDA

View Full Version : drop downs and rollovers together



spuzo
02-26-2006, 07:13 PM
I am trying to get a dropdown script and a rollover script to work together...they each work perfectly seperate, but when I try to get them together they do nothing. I am assuming there is something I need in the head where the javascript is. I am just learning, so pardon my ignorance if this is a stupid question...I would REALLY appreciate some help~

Again...two javascripts, how do you get them to work together!?

Thanks

Stacy

jscheuer1
02-27-2006, 01:56 PM
There are at least several ways a drop down can be coded to activate and likewise a rollover. If you are lucky and both scripts use onmouseover and onmouseout events in the HTML portion of the page to do this, integration may be fairly easy. That is unless both scripts use the onload event of the page as well, then things get a bit more complex. Adding another layer of complexity would be if one or both scripts writes its own events to the HTML elements involved.

Unfortunately, to make matters less straightforward, there are other possible variations that may look less complex than they actually are.

However, if everything is as simple as it could possibly be, correctly combining the onmouseover and onmouseout events would be all that is necessary. Say, your image has a rollover and is a link's (that has a drop down) activating element:


<a href="#" onclick="return false;" onmouseover="dropdown('something');" onmouseout="hide('something');"><img onmouseover="rollover(this);" onmouseout="rollback(this);" src="whatever.jpg"></a>

Then, the two can often be combined, like so:


<a href="#" onclick="return false;"><img onmouseover="rollover(this);dropdown('something');" onmouseout="rollback(this);hide('something');" src="whatever.jpg"></a>

If you need more help, we need to see your code:

PLEASE: Include the URL to your problematic webpage that you want help with.