PDA

View Full Version : Swap Image on "onClick" and restore image on "onMouseUp"



- |Flash Man| -
November 5th, 2006, 08:10 PM
Hey all,

i have one image and when its selected i want to have it so that it will swap image with the same image but just with a border around it. Also i'm trying to have it so that only 2 out of the 4 can get selected at a time...i'm using dreamweaver any ideas on how??

Cheers http://www.pixel2life.com/forums/style_emoticons/default/smile.gif

brndn
November 5th, 2006, 08:48 PM
css or javascript would be where id start looking.
Are you familiar with either?

- |Flash Man| -
November 5th, 2006, 08:50 PM
yes i'm doing the swap image atm through javascript behavious but how to only allow 2 to be selected i don't know

simplistik
November 5th, 2006, 09:01 PM
onmousedown="this.style.backgroundImage = url('link_to_your_click_url')" onmouseup="this.style.backgroundImage = url('link_to_your_orignal_image')"

not the most efficient IMO, but that's what you asked for so that's what I gave you :D, and what I think you'll understand the easiest.

EDIT: sorry rewrote the code :) hopefully no one saw my mistake :P

- |Flash Man| -
November 5th, 2006, 09:05 PM
cool i'll give that ago...but how would you say allow on 2 of the 4 images to be selected?? at a time??

- |Flash Man| -
November 5th, 2006, 09:05 PM
Thanks :)

simplistik
November 5th, 2006, 09:07 PM
cool i'll give that ago...but how would you say allow on 2 of the 4 images to be selected?? at a time??

ummm... then you'd use a variable, onclick and an if statement... i'm not sauvy enough to do that one off the top of my head so maybe someone else will hook you up with that :D

- |Flash Man| -
November 5th, 2006, 09:20 PM
awesome cheers i'll have a play and see what comes too from it all cheers again :)

denizengt
November 6th, 2006, 12:30 AM
Inline style changes! naughty!!

simplistik
November 6th, 2006, 02:27 AM
Inline style changes! naughty!!



not the most efficient IMO, but that's what you asked for so that's what I gave you :D, and what I think you'll understand the easiest.


:huh: :P