Schmoopy
11-03-2008, 05:07 PM
Hi there, I recently uploaded an image map with centres on it that the user can click and text appears next to the map describing the centre. At the moment it all works fine, but it doesn't seem to be very efficient to me as there is lots of code which I think could be condensed down, although I'm not sure how.
You can see what I mean here:
http://www.bombthehills.com/ridingspots-uk.html
The code I am referring to is this:
<area shape="circle" coords="283,656,7" href="javascript:ReverseDisplay('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="ivyleaf">
<area shape="circle" coords="299,647,7" href="javascript:ReverseDisplay('swmbc'); javascript:HideContent('ivyleaf'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="MBC">
<area shape="circle" coords="351,636,8" href="javascript:ReverseDisplay('quantock'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="quantock">
<area shape="circle" coords="459,643,8" href="javascript:ReverseDisplay('haredown'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="haredown">
<area shape="circle" coords="501,641,8" href="javascript:ReverseDisplay('knockhill'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="knockhill">
<area shape="circle" coords="285,253,9" href="javascript:ReverseDisplay('airfusion'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="airfusion">
<area shape="circle" coords="488,616,8" href="javascript:ReverseDisplay('xbp'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="xbp">
<area shape="circle" coords="464,606,8" href="javascript:ReverseDisplay('oakwood'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="oakwood">
<area shape="circle" coords="447,595,8" href="javascript:ReverseDisplay('waterside'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="waterside">
<area shape="circle" coords="291,291,8" href="javascript:ReverseDisplay('newmilns'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="newmilns">
<area shape="circle" coords="364,476,8" href="javascript:ReverseDisplay('halesb'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="halesb">
<area shape="circle" coords="361,514,10" href="javascript:ReverseDisplay('edge'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="edge">
<area shape="circle" coords="359,545,8" href="javascript:ReverseDisplay('courtfarm'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="courtfarm">
etc... (Too long for post)
What I want to happen is that when you click on a centre, it hides any centre that is currently showing and replaces it with the one the user clicks, so instead of writing out HideContent for every single possibility is there not a way where i can use (*) or something to hide all? This would make it much more readable and save on time and file size.
Hope you can help with this,
Thanks,
Jack.
You can see what I mean here:
http://www.bombthehills.com/ridingspots-uk.html
The code I am referring to is this:
<area shape="circle" coords="283,656,7" href="javascript:ReverseDisplay('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="ivyleaf">
<area shape="circle" coords="299,647,7" href="javascript:ReverseDisplay('swmbc'); javascript:HideContent('ivyleaf'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="MBC">
<area shape="circle" coords="351,636,8" href="javascript:ReverseDisplay('quantock'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="quantock">
<area shape="circle" coords="459,643,8" href="javascript:ReverseDisplay('haredown'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="haredown">
<area shape="circle" coords="501,641,8" href="javascript:ReverseDisplay('knockhill'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="knockhill">
<area shape="circle" coords="285,253,9" href="javascript:ReverseDisplay('airfusion'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="airfusion">
<area shape="circle" coords="488,616,8" href="javascript:ReverseDisplay('xbp'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="xbp">
<area shape="circle" coords="464,606,8" href="javascript:ReverseDisplay('oakwood'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="oakwood">
<area shape="circle" coords="447,595,8" href="javascript:ReverseDisplay('waterside'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="waterside">
<area shape="circle" coords="291,291,8" href="javascript:ReverseDisplay('newmilns'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="newmilns">
<area shape="circle" coords="364,476,8" href="javascript:ReverseDisplay('halesb'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('edge'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="halesb">
<area shape="circle" coords="361,514,10" href="javascript:ReverseDisplay('edge'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('courtfarm'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="edge">
<area shape="circle" coords="359,545,8" href="javascript:ReverseDisplay('courtfarm'); javascript:HideContent('ivyleaf'); javascript:HideContent('swmbc'); javascript:HideContent('quantock'); javascript:HideContent('haredown'); javascript:HideContent('knockhill'); javascript:HideContent('airfusion'); javascript:HideContent('xbp'); javascript:HideContent('oakwood'); javascript:HideContent('waterside'); javascript:HideContent('newmilns'); javascript:HideContent('halesb'); javascript:HideContent('edge'); javascript:HideContent('redhill'); javascript:HideContent('outtograss'); javascript:HideContent('bugsboarding');" alt="courtfarm">
etc... (Too long for post)
What I want to happen is that when you click on a centre, it hides any centre that is currently showing and replaces it with the one the user clicks, so instead of writing out HideContent for every single possibility is there not a way where i can use (*) or something to hide all? This would make it much more readable and save on time and file size.
Hope you can help with this,
Thanks,
Jack.