Go Back   TheAppleBlog Forums > Apple/Mac > Development
Register Social Groups iSpy Members List Search Today's Posts Mark Forums Read FAQ

Development XCode, Cocoa, and all other development

Reply
 
LinkBack Thread Tools Search this Thread
12-17-2008   #1 (permalink)
Business Consultant
 
asadeddin's Avatar
 
Join Date: Apr 2007
Location: Ottawa, Canada
Posts: 190
asadeddin has disabled reputation
Send a message via AIM to asadeddin Send a message via Skype™ to asadeddin
Hey all..

I've got a little problem on my hands. I've been working on my website and I am creating a portfolio page. Now I've created this nifty space saver that makes the website look more sleek and simple. The idea is when a visitor clicks on one of the thumbnails of any of the websites I've made they get a text description about the website. The problem is that when I click on two different links I get two different texts. I want it to only show text for one of the links at a time. So if I click Hidden 1, only hidden 1 shows and when I click Hidden 2 it hides Hidden 1 and shows Hidden 2 only and vica versa. Here's my code:

Code:
<html>
<head>
	<script language="javascript"> 
<!-- 
var state = 'hidden'; 

function showhide(layer_ref) { 

if (state == 'visible') { 
state = 'hidden'; 
} 
else { 
state = 'visible'; 
} 

if (document.all) { //IS IE 4 or 5 (or 6 beta) 
eval( "document.all." + layer_ref + ".style.visibility = state"); 
} 
if (document.layers) { //IS NETSCAPE 4 or below 
document.layers[layer_ref].visibility = state; 
} 
if (document.getElementById && !document.all) { 
maxwell_smart = document.getElementById(layer_ref); 
maxwell_smart.style.visibility = state; 
} 
} 
//--> 
</script> 
</head>
<body>
<!-- HIDDEN 1 INFORMATION TO BE SHOWN ONCLICK --> 
<div id="hidden1" style="visibility:hidden">
Hidden 1 text!!!! </div>
<!-- END - HIDDEN 1 INFORMATION TO BE SHOWN ONCLICK --> 
<a href="javascript://" onclick="showhide('hidden1');">Hidden 1</a>

<!-- HIDDEN 2 INFORMATION TO BE SHOWN ONCLICK --> 
<div id="hidden2" style="visibility:hidden">
Hidden 2 text!!!!
</div> 
<!-- END - HIDDEN INFORMATION TO BE SHOWN ONCLICK --> 
<a href="javascript://" onclick="showhide('hidden2');">Hidden 2</a>


</body>
</html>
Hope you guys can help. Thanks...
__________________
MB: 1.83GHz Intel CD, 1 GB RAM, 60GB Internal HD and 320 GB LaCie External
www.orangebinder.com
asadeddin is offline   Reply With Quote
12-24-2008   #2 (permalink)
Operator
 
Join Date: Dec 2008
Posts: 1
stannyc has disabled reputation
The fix is relatively simple. Instead of passing the entire name of the object to be made visible, just pass the NUMBER. Then, in your JavaScript code, first set BOTH of the objects visibility to FALSE, and then set the appropriate object's visibility to TRUE.

Stan
stannyc is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 10:49 AM.




Powered by vBulletin
© 2004-2009

SEO by vBSEO 3.2.0