Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: image swapping


Message #1 by "Colin Montgomery" <colin.montgomery@c...> on Mon, 29 Oct 2001 17:27:28
Just to let you know I got it working. Code below if you're interested:

//swap the bullet image
function swapImg (imgNum, secNum)
{
	objImg = document.getElementById(imgNum)
	if (secNum.style.display=="none")
		{
		objImg.src="../../img/plus.gif"
		}
	else
		{
		objImg.src="../../img/minus.gif"
		}
}

Calling code/HTML:

<td onclick="doSection(part1);swapImg('img1',part1)">
	<img src="../../img/plus.gif" id="img1">
</td>

where doSection is a function toggling the child element's .style.display 
attribute, and part1 is the id of this 1st child section.

Thanks for your help guys,
Colin

  Return to Index