close

HTML (DHTML)

close Method

Internet Development Index

Closes an output stream and forces the sent data to display.

Syntax

document.close()

Return Value

No return value.

Remarks

When a function fired by an event on any object calls the close method, the window.close method is implied.

<SCRIPT LANGUAGE="JScript">
function foo() {
close();}
</SCRIPT>
<BODY onclick="foo();">
Click this page and window.close() is called.
</BODY>

When an event on any object calls the close method, the document.close method is implied.

Note  When document.write or document.writeln is used in an event handler, document.close should also be used.
<BUTTON onclick="close();">
Click this button and document.close() is called.
</BUTTON>

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

document

See Also

open