Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q464 How you destroy a layer created using new Layer()?

You are here: irt.org | FAQ | DHTML | Q464 [ previous next ]

You can't. Netscape appear not to have included a destructor method for Layers.

Normally you destroy an object by making the reference to it null. But the following example does not do what I expected it to do:

<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript"><!--
function newLayer() {
    alayer = new Layer(100);
}

function killLayer() {
    if (document.layers.length > 0)
        document.layers[document.layers.length - 1] = null;
}
//--></SCRIPT>

</HEAD>

<BODY>

<FORM>
<INPUT TYPE="BUTTON" onClick="newLayer()" VALUE="Create a layer">
<INPUT TYPE="BUTTON" onClick="killLayer()" VALUE="Destroy a layer">
</FORM>

</BODY>

Feedback on 'Q464 How you destroy a layer created using new Layer()?'

©2018 Martin Webb