Log in

View Full Version : Hiding content



Schmoopy
10-31-2008, 04:02 PM
Hi again, sorry to post so many threads, but this is the first proper website I'm doing so sort of new to it all...

I'm redoing a UK map, so that it shows riding centres when clicked on. It's been fine so far and I can do it in a way that will work, but seems very inefficient to me, and looks like it takes up more room than it needs to.

I want the content to show when clicked and then hide when clicked again, or when a different riding centre is clicked, here is the webpage:
http://www.bombthehills.com/ridingspots-uk2.html

The code for the image map is as follows (just doing 2 for now):

<img src="images/map/ukcentres.png" alt="Europe" usemap="#map" style="border:none; position:absolute; left:550px; top:450px;">
<map name="map" id="map">
<area shape="circle" coords="283,656,7" href="javascript:ReverseDisplay('ivyleaf'); javascript:HideContent('swmbc')" alt="ivyleaf">
<area shape="circle" coords="298,647,7" href="javascript:ReverseDisplay('swmbc'); javascript:HideContent('ivyleaf')" alt="MBC">
</map>

And here's the code for the content divs:

<div id="ivyleaf" class="ukcentres" style="display:none"><span style="font-size:16px; font-weight:bold">Ivyleaf Mountainboarding Centre</span><p></p>Address: Ivyleaf, Stratton, Bude, Cornwall, EX23 9LD<br>Tel: 07773 069716<br>Email: info@ivyleafmountainboarding.co.uk<br>Web: <a href="http://www.ivyleafmountainboarding.co.uk">www.ivyleafmountainboarding.co.uk</a><br>Skill level: Beginner to advanced<br>Opening times: Sun-Fri: 10am-4pm<br> Sat: Closed, Club (Sun): 2pm-4pm</div>
<div id="swmbc" class="ukcentres" style="display:none">Other riding centre will go here</div>

So the main part I'm focusing on is the:
href="javascript:ReverseDisplay('swmbc'); javascript:HideContent('ivyleaf')"
I want to know a way where I can hide all other content that could be visible without having to write javascript:HideContent('ivyleaf'), javascript:HideContent('2ndcentre'); javascript:HideContent('3rdcentre')"
etc...

Is there a more efficient way to accomplish this?

Please ask me anything you don't understand, as I'm not sure if this is confusing to you,

Thanks in advance for any help given,

Jack :)