View Full Version : Java?
chalky
11-05-2002, 02:21 PM
http://www.honda.co.uk/motorcycles/DispatcherServlet?hidActionDetail=viewproductdetail&hidAction=Lookup&hidProductID=60&hidSelectedProductCode=C90_CUB_E&hidProductName=C90+Cub+Electric&hidMSGID=3&hidMSGCode=LEGAL&hidMSGName=Learner+Legal&hidBannerPath=en%2Fpicture%2Fproduct%2FC90_CUB_E%2FMain%2Fprd_main_Banner.jpg&hidHomePath=%2Fjsp%2FmsgLEGALHome.jsp
Can some body explain how the colour change gifs link to bikes gifs , complete beginner but would like to do something very simular, 4-5 buttons 4-5 changes of picture.
Only guessing its java if not what is it?
TIA chalky
kdjoergensen
11-05-2002, 05:20 PM
Are you talking about the red and blue square which will change the color of the bike when pressed on ?
Lets say you have a picture of a bike:
<img src='redbike.gif' name='mybike' height=100 width=100>
Lets say you another place on the page has a link with a red cube enclosed within the link:
<a href="javascript:...">
<img src='redcube.gif' height=10 width=10>
</a>
<a href="javascript:...">
<img src='bluecube.gif' height=10 width=10>
</a>
Now all we need to do is to add some javascript (not java, but javascript.. confusing I know !!) to the href (links) tags:
In the first link:
<a href="javascript: document.images['mybike'].src='redbike.gif'; return false;">
In the second link:
<a href="javascript: document.images['mybike'].src='bluebike.gif'; return false;">
What happens is this:
when the links are pressed javascript will go to the image 'mybike' located elsewhere on the page and change the source (.src property) to a new image (either redbike.gif or bluebike.gif depending on which square you pressed).
Don't worry about the 'return false' statement. it is needed in the link.
chalky
11-06-2002, 01:45 PM
Finally sussed it, thanks for help.
Chalky
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.