| | |
photo and text swap
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 4
Reputation:
Solved Threads: 0
I am trying to swap an image with 6 guys on a couch for each one sitting individual. And once the individual is showing, display their bio underneath. I can get the image to change and the text to show but when I roll to the next guy the text doesn't swap but overlaps. I am very new to Javascript so speak down to me, thanks 
Each div of text starts with display:none
When I mouseover, the ShowHide displays the text, the return ShowPic shows the image but then I need that text to go away when I mouse off or mouse over the next person's name.
Thanks for your help!!

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<a onmouseover="javascript:showHide('jeff'); return showPic(this)" href="/images/group_jeff.jpg" class="560" name="357" >Jeff</a>
Each div of text starts with display:none
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<div id="jeff" style="display:none">
When I mouseover, the ShowHide displays the text, the return ShowPic shows the image but then I need that text to go away when I mouse off or mouse over the next person's name.
Thanks for your help!!
•
•
Join Date: Jun 2008
Posts: 4
Reputation:
Solved Threads: 0
Here are the 2 pieces of code
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
//Text Show/Hide function showHide(elementid){ if (document.getElementById(elementid).style.display == 'none'){ document.getElementById(elementid).style.display = ''; } else { document.getElementById(elementid).style.display = 'none'; } } // Image Swap function showPic (whichpic) { if (document.getElementById) { document.getElementById('placeholder').src = whichpic.href; document.getElementById('popuplink').href = whichpic.href; document.getElementById('popuplink').className = whichpic.className; document.getElementById('popuplink').name = whichpic.name; if (whichpic.title) { document.getElementById('placeholder').alt = whichpic.title; } return false; } else { return true; } }
Last edited by designermom2; Jun 12th, 2008 at 10:28 am.
you can move these events out into a function, but im just keeping it simple.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<div onmouseover="document.getElementById('img1').style.display='block';document.getElementById('txt1').style.display='none';" onmouseleave="document.getElementById('txt1').style.display='block';document.getElementById('img1').style.display='none';"> <img id="img1" src="img1.jpg" style="display: none;"> <div id="txt1" style="display: block"> text 1</div> </div>
no, display:none is correct.
your thinking of visibility:hidden
and display:none is better then visibility:hidden because it actually collapses the element rather then just hiding it and leaving a big empty space.
your thinking of visibility:hidden
and display:none is better then visibility:hidden because it actually collapses the element rather then just hiding it and leaving a big empty space.
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: block f5 functionality
- Next Thread: automatically html page has to upload to live website
Views: 1704 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxexample ajaxjspservlets array autoplay blackjack browser captcha captchaformproblem cart child close codes date debugger decimal dependent developer disablefirebug dom element embed engine enter events ext file firefox flash focus form forms frameworks game gears getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index java javascript javascripthelp2020 javascripts jquery jsp jump libcurl listbox maps marquee masterpage math media menu mp4 onerror onmouseoutdivproblem onmouseover onreadystatechange paypal pdf php player position post programming prototype rated redirect safari scale scriptlets scroll search security size software solutions sources star starrating stretch synchronous toggle tweet unicode variables web webkit webservice window \n






