Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | DHTML | Q464 [ previous next ]

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

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()?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.