Rohit asked:

> Anyone know how I can remove a whole tag (in this case an LI)
> from visibility based on a variable using javascript (or anything else).

Spent quite some time perfecting this for our HTML help as it happens.

The inline version goes somthing like this:

<LI ID=idList><SCRIPT>idList.style.display='none';</SCRIPT>

which will hide an object before the user ever gets to see it. Good for
initialising collapsed tables of data.

The callable function goes something like this:

<SCRIPT Language=JavaScript>
function ToggleDisplay(oItems)
{
    if ((oItems.style.display == "") || (oItems.style.display == "none"))
{
        oItems.style.display = "block";
    } else {
        oItems.style.display = "none";
    }
    return false;
}

...

<LI ID=idList ONCLICK="return ToggleDisplay(idList);">

Of cource after the first click it will be invisible, so I usually use
something else as the "button" that toggles the display state of the list
items. You could probably convert this into VBScript if that is more your
cup of tea...

Cheers, Max.


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to