PDA

View Full Version : Using Swap Image Behaviour Twice


Ricky55
02-13-2006, 08:46 AM
Hi

There's probably a really easy answer to this but I'm new to Dreamweaver so any help will be greatly received.

I have menu on my page with simple roll over buttons that just change colour when the mouse rolls over. These are restored when the mouse rolls off, these are just simple roll over images.

I want these buttons to change the main image on the page, to achieve this I have used the swap image behavior again.

This all works ok but I'm finding that the restore that I'm using for the buttons is also restoring the main image and I don't want it to.

How do I prevent this from happening???

I just want the menu buttons to restore i.e. work as simple roll over images and I want the swap image behavior used on the main image to remain until a new button is pressed.

Thanks

Ricky55

davidj
02-13-2006, 10:04 AM
best write this yourself

leave your swap image function on the buttons but remove the one that changes the main page image

wrap your main image in a <div and give it an ID
example...
<div ID="chg">image.jpg</div>

function swapper(i){

a = document.getElementById('chg');

switch (i){
case '1': a.innerHTML = 'image2.jpg'; break;
case '2': a.innerHTML = 'image3.jpg'; break;
case '3': a.innerHTML = 'image4.jpg'; break;

}
}

please post your buttons code so i can work out where you need to call this function

Ricky55
02-13-2006, 10:21 AM
thanks for your response mate.

I've actually managed to get around this by inserting my buttons into a naigation bar. Once in the nav bar I can apply the swap image behavior for the main image and this works as the restore is now separated by the navigation bar.

Thanks for anwswering though.

Ricky55