Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Closed Thread
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-05-2008, 04:21 PM   PM User | #1
Webill
New to the CF scene

 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Webill is an unknown quantity at this point
Show/HIde + change image >>need help!

Hi There I have written a script that should do the following:

1- Click on add.png that changes in the minus.png , opens a hidden DIV with text and changes a photo all at the same time.
2- When then the delete.png is clicked everything has to go back to the original situation.

What does not work:
1- the add.png does not change into delete.png
2- the photo does not reset to the original one when the div is closed.

Here is my code:


<script language="Javascript 1.2" type="text/javascript">
function show(id)

{
el = document.getElementById(id);
if (el.style.display == 'none')
{
el.style.display = '';
el = document.getElementById('more' + id);
el.innerHTML.thisImage = 'images/add.png';
} else {
el.style.display = 'none';
el = document.getElementById('more' + id);
el.innerHTML.thisImage = 'images/delete.png';
}
}

function change_pic(val) {
document.getElementById('image_name').src = val;

}

</script>

Here is the HTML

<div class="foto">
<img name="image_name" id="image_name" src="../images/AllCd.jpg" border="0" alt="i">
</div>


<p><strong> Olthuis</strong>
<a id="moreinfo" href="# " onclick="javascript:show('info'), change_pic('../images/Olthuis.jpg'); return false;">
<img src="add.png" ></a></p>
<div id="info" style="display: none">
BLABLABLA text
</div>
<p><strong>Teddy </strong> -
<a id="moreinfo2" href="#" onclick="javascript:show('info2'), change_pic('../images/teddy.jpg'); return false;">
<img src=".add.png" ></a></p>
<div id="info2" style="display: none">
BLABLABLA text
</div>
<p><strong>Hermr</strong>
<a id="moreinfo3" href="#" onclick="javascript:show('info3'), change_pic('../images/ermine.jpg'); return false;">
<img src="add.png" ></a></p>
<div id="info3" style="display: none">
BLABLABLA text
</div></div></div>

THANK YOU!
Webill is offline  
Old 05-05-2008, 04:26 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Please read the forum rules and guide lines,
http://www.codingforums.com/postguide.htm
http://www.codingforums.com/rules.htm

(selection of forum, cross posting etc.)

then after http://www.codingforums.com/showthread.php?t=82672, regarding how to post your code here.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline  
Old 05-05-2008, 10:42 PM   PM User | #3
WA
Administrator


 
Join Date: Mar 2002
Posts: 2,596
Thanks: 2
Thanked 19 Times in 18 Posts
WA will become famous soon enough
Closing this thread, as it's repeated here: http://www.codingforums.com/showthread.php?t=139058
__________________
- George
- JavaScript Kit- JavaScript tutorials and 400+ scripts!
- JavaScript Reference- JavaScript reference you can relate to.
WA is offline  
Closed Thread

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 12:27 AM.


Advertisement
Log in to turn off these ads.