Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Toggle image link with JavaScript
Old 08-17-2006, 07:05 AM Toggle image link with JavaScript
FOOOD's Avatar
Average Talker

Posts: 25
Name: Jono
Trades: 0
I'm using the scriptaculous Toggle Slide effect, & use an image link (button) to toggle the box to slide down & up.

What I'd like to do it toggle the image link so when it's clicked it's replaced by a different image. Once it's clicked again it switches back to the original image.


Here is the code I'm using:
Code:
<a href="javascript:;" onclick="Effect.toggle('up-down','slide'); return false;"><img src="images/first-image.jpg" alt="toggle" /></a>

<div id="up-down" style="display: none;">
<p>'Content'</p>
</div>
And the other image I like to toggle between is:

"images/second-image.jpg"

Anyone know how I can do this?
FOOOD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-18-2006, 01:26 AM Re: Toggle image link with JavaScript
FOOOD's Avatar
Average Talker

Posts: 25
Name: Jono
Trades: 0
Never mind, I managed to find out how to do this
FOOOD is offline
Reply With Quote
View Public Profile
 
Old 08-25-2006, 08:11 PM Re: Toggle image link with JavaScript
kIDJOE's Avatar
Extreme Talker

Posts: 186
Location: Hollywood, CA
Trades: 0
send me a URL im loving RoR
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

kIDJOE is offline
Reply With Quote
View Public Profile Visit kIDJOE's homepage!
 
Old 02-11-2007, 06:54 PM Re: Toggle image link with JavaScript
Junior Talker

Posts: 1
Name: Solan
Trades: 0
Quote:
Originally Posted by FOOOD View Post
Never mind, I managed to find out how to do this
Aaaarrrghh! - I zapped on here because your problem is EXACTLY what I'm trying to do. WITH Scriptaculous too!!!

So what did you find out????
Pleeease
Newrone is offline
Reply With Quote
View Public Profile
 
Old 02-13-2007, 02:43 AM Re: Toggle image link with JavaScript
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
Newrone this is for you:
HTML Code:
<html>
<head>
<script>
function toggle() {
 if( document.getElementById("hidethis").style.display=='none' ){
   document.getElementById("hidethis").style.display = '';
    document.getElementById("showthis").style.display = 'none';
 }else{
   document.getElementById("hidethis").style.display = 'none';
    document.getElementById("showthis").style.display = '';
 }
}
</script>
</head>
<body>
<span onClick="toggle();"><IMG SRC="../img1.gif" WIDTH="259" HEIGHT="32" BORDER="0" ALT=""  name="hidethis">
 <IMG SRC="../img2.gif" WIDTH="259" HEIGHT="32" BORDER="0" ALT="" style="display:none" name="showthis">
</span><br /><br />

</body>
</html>
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Toggle image link with JavaScript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.01821 seconds with 12 queries