HighDots Forums  

ARRRRRGH

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss ARRRRRGH in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Penelope Baker
 
Posts: n/a

Default ARRRRRGH - 10-09-2005 , 08:42 PM






OK, I have the world's stupidest(!) question.

I need to click on an image. Swap it to another image, which stays static
until it's clicked on again. At which point it needs to return to the
original image.

IE: I'm trying to make a 'sound on' 'sound off' button/control thingee
without having to put Flash on this site for 15 lousy pixels.

THANKS!

--
Peace,
Pen
-----------
Pawbreakers - The Candy for Cats!
http://www.pawbreakers.com



Reply With Quote
  #2  
Old   
Penelope Baker
 
Posts: n/a

Default Re: ARRRRRGH - 10-11-2005 , 02:56 PM






"Penelope Baker" <penelope_baker (AT) hotmail (DOT) com> wrote

Quote:
OK, I have the world's stupidest(!) question.

I need to click on an image. Swap it to another image, which stays static
until it's clicked on again. At which point it needs to return to the
original image.

IE: I'm trying to make a 'sound on' 'sound off' button/control thingee
without having to put Flash on this site for 15 lousy pixels.

THANKS!

--
Peace,
Pen
-----------
Pawbreakers - The Candy for Cats!
http://www.pawbreakers.com
I gave up and used flash. Why fight a losing battle. :P

Thanks :-)

Peace,
Pen




Reply With Quote
  #3  
Old   
Jasen Betts
 
Posts: n/a

Default Re: ARRRRRGH - 10-16-2005 , 01:50 AM



On 2005-10-10, Penelope Baker <penelope_baker (AT) hotmail (DOT) com> wrote:
Quote:
OK, I have the world's stupidest(!) question.

I need to click on an image. Swap it to another image, which stays static
until it's clicked on again. At which point it needs to return to the
original image.

IE: I'm trying to make a 'sound on' 'sound off' button/control thingee
without having to put Flash on this site for 15 lousy pixels.
you can do this by changing the src property of the img.

when examined the src property of the img has the complete URL not
just the fragment you specify in the HTML file or assign it in the handler.
this may have been what was causing you trouble.



//javascript:
function swapimg(pic){
if(pic.src.match(/\/down.gif$/)) // see if string ends with "/down.gif"
{ pic.src="icons/up.gif";} // if so it becomes "up"
else
{pic.src="icons/down.gif";} // othewise down
};

<!-- HTML: -->
<img src="icons/up.gif" onclick="swapimg(this)">


--

Bye.
Jasen


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.