In your script function after <script type="text/javascript">, add the following code. These are functions I've created so it will first clear all the dark blocks, then add the dark block to the specified location, then change the image.
<pre>function doBoth(objNameChg,imgNameChg,imgSrcChg,imgSrcGrey){
clearpic(imgSrcGrey);
movepic(imgNameChg,imgSrcChg);
changeIt(objNameChg);
}
function clearpic(imgSrcClr){
document.button1.src=imgSrcClr;
document.button2.src=imgSrcClr;
document.button3.src=imgSrcClr;
document.button4.src=imgSrcClr;
document.button5.src=imgSrcClr;
document.button6.src=imgSrcClr;
document.button7.src=imgSrcClr;
document.button8.src=imgSrcClr;
document.button9.src=imgSrcClr;
document.button10.src=imgSrcClr;
}
function movepic(img_name,img_src) {
document[img_name].src=img_src;
}</pre>
The following code is the code for your blocks below the picture. You have to use the doBoth function instead of the changeIT function. I've changed the first block to be dark from the start.
<pre>
<a id="1" href="#id=1" onclick="doBoth('BSC5.jpg','button1','images/blockDark.gif','images/blockGrey.gif')"><img name="button1" src="images/blockDark.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="2" href="#id=2" onclick="doBoth('BSC4.jpg','button2','images/blockDark.gif','images/blockGrey.gif')"><img name="button2" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="3" href="#id=3" onclick="doBoth('BSC3.jpg','button3','images/blockDark.gif','images/blockGrey.gif')"><img name="button3" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="4" href="#id=4" onclick="doBoth('BSC2.jpg','button4','images/blockDark.gif','images/blockGrey.gif')"><img name="button4" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="5" href="#id=5" onclick="doBoth('BSC1.jpg','button5','images/blockDark.gif','images/blockGrey.gif')"><img name="button5" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="6" href="#id=6" onclick="doBoth('140T1014.jpg','button6','images/blockDark.gif','images/blockGrey.gif')"><img name="button6" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="7" href="#id=7" onclick="doBoth('140T1011.jpg','button7','images/blockDark.gif','images/blockGrey.gif')"><img name="button7" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="8" href="#id=8" onclick="doBoth('140T1009.jpg','button8','images/blockDark.gif','images/blockGrey.gif')"><img name="button8" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="9" href="#id=9" onclick="doBoth('140T1008.jpg','button6','images/blockDark.gif','images/blockGrey.gif')"><img name="button9" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /><a id="10" href="#id=10" onclick="doBoth('140T0986.jpg','button6','images/blockDark.gif','images/blockGrey.gif')"><img name="button10" src="images/blockGrey.gif" border="0" /></a><img src="images/clear.gif" width="12" height="1" /></pre>
This isn't the prettiest or most efficient way to do it, but it will work. Let me know if there are problems.
Excellent, that works perfectly. Thank you so much I was beginning to give up on this! Really appreciate your efforts.
How can I accept your answer as the solution? And give you points? I was expecting this site to be similar to EE but I can’t figure this one out?
No need to accept it. We get points by posting.