PDA

View Full Version : remove attribute ("TD") ... how?


homerUK
11-30-2002, 06:06 PM
hi guys,

I need some help with a script I've written.
I show a different image depending on the users selection of an option...

eg: show "disabled icon" if the user selects the disabled button, or show the "enabled icon".

This is a basic script so that the user can decide which options they want available on a program. The page consists of a few rows, each with their own ID, so the background cell color can be changed depending on if they select "enabled" or "disabled"... ok with me so far?!! :p

When the pag loads, I have a script that looks like this (embedded in a <td></td> tag...)


<td><script>initImage('on','filename.gif','name')</script></td>


so when the page is loaded it called "initImage" which looks like this:


function initImage(status,path,name)
{
//draw the image on or off on page load

if (status == "on") {
document.write("<img src=" + path + "' align='absbottom'>&nbsp;" + name);
}

if (status == "off") {
document.write("<img src=" + path + "' align='absbottom'>&nbsp;" + name);
}

}


so the image is drawn on or off.....
but... I have some more code which is called when the user CHANGEs the options... so if the curent value of the option was disabled, it would change the bg cell color and the image to "ENABLED".....

But.... I need a way to actually remove the image that is drawn above by the document.write..

how would I do a search for it, or actually remove it from the screen???

Cheers....