View Single Post
11-28-2007, 06:31 AM
#9
CreativeLogic is offline CreativeLogic
CreativeLogic's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,078
iTrader: 6 / 100%
 

CreativeLogic is on a distinguished road

Send a message via MSN to CreativeLogic

  Old

I've edited the file as I'm not sure what the problem is without having the source files on my end. This is all you need in your javascript file. The previous functions you created are not needed.
Code:
function swap (id)
{
	var el = document.getElementById(id);
	var split = el.innerHTML.split (' ');
	if (split[0] == 'Hide')
	{
		// ##### SHOW CONTAINER ####
		document.getElementById(id + '_container').style.display = 'none';

		// ##### CHANGE TEXT #####
		el.innerHTML = 'Show ' + split[1];
	}
	else
	{
		// ##### HIDE CONTAINER ####
		document.getElementById(id + '_container').style.display = 'none';

		// ##### CHANGE TEXT #####
		el.innerHTML = 'Hide ' + split[1];
	}
}

function hide (id)
{
	// ##### HIDE CONTAINER ####
	document.getElementById(id + '_container').style.display = 'none';

	// ##### CHANGE TEXT #####
	var el = document.getElementById(id);
	var split = el.innerHTML.split (' ');
	el.innerHTML = 'Show ' + split[1];
}
You do not need your previous functions for the links. This is exactly what your links should look like. I've edited them to be slightly more 'standard'.
Code:
<a href="#" id="terms" onclick="swap (this.id); hide ('options'); return false;" />Show Terms</a>
<a href="#" id="options" onclick="swap (this.id); hide ('terms'); return false;" />Show Options</a>