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

Q632 Is is possible to trap the escape key and cause it to close the browser window?

You are here: irt.org | FAQ | JavaScript | Window | Q632 [ previous next ]

Only in Internet Explorer 5b2 and possibly Internet Explorer 4:

<HEAD>
<SCRIPT LANGUAGE="JavaScript1.2"><!--
function microsoftKeyPress() {
    if (window.event.keyCode == 27)
        window.close();
}
//--></SCRIPT>

</HEAD>

<BODY onKeyPress="microsoftKeyPress()">
</BODY>

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop