[Javascript] Re: Replace element with another element on click

Matthew Palmer mpalmer at hezmatt.org
Wed Mar 23 00:40:44 CST 2005

On Wed, Mar 23, 2005 at 12:59:42AM -0600, judah wrote:
> I was curious how to replace a element with another element when the 
> user clicks a checkbox. If checkbox is enabled then replace element A 
> with B (erase A). If checkbox is unchecked then replace element B with A 
> (erase B).

Off the top of my head:

function checkboxOnClick(box)
	if (box.checked)

Write the show and erase functions yourself, and make the onClick handler
for the checkbox javascript:checkboxOnClick(document.form.checkbox);

- Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050323/4ef2e72f/attachment.pgp>

More information about the Javascript mailing list