Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dual div swap on link rollover?

Status
Not open for further replies.

serea

Programmer
Sep 23, 2009
2
US
I am looking for advice on a way to accomplish this. Given the following:

[Div A (contains an image)]
[Div B (contains a horizontal list of 8 or so text links)]
[Div C (contains text)]

Upon rolling over any link in Div B, how can I have Div A and Div C swap their respective contents out to something different that corresponds to the content of that link?

For example, if one were to rollover a Div B link called "Dogs", then upon that rollover, Div A would replace its contents and display an image of a dog and Div C would replace its contents and display text about dogs.

After rolling over that link, the new Div A and Div C contents will remain in place until a new link is rolled over.

I hope this makes sense. Does anyone have advice on the best way to accomplish this? Should I post this in the Javascript forum instead?
 
Javascript obviously.

Depending on where you have the information stored, you can:

1. Create 8 sets of DIVs with the information you need and set all but the default one's display to "none" so they are not visible, and using javascript change the adequate divs to be shown and hide the rest when a link is rolled over.

2. Create an array that will hold the information for the divs, and alter the innerHTML of the content div, and the img src in the div holding the image to the one you want to display.

3. Use ajax to call up a server side language script to connect to a database or external file and get the information you need, and then like in option 2. alter the innerHTML and image src attributes accordingly.

Now, since none of these involve html beyond the default layout I would suggest asking in forum216 or the forum1600 for more specifics.






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thank you very much! I probably should have posted in the Javascript forum. But thanks for pointing me in the right direction, this helps a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top