Close Window On KeyPress

[Total: 0    Average: 0/5]

Ever want a page to be closed on a key press?

Body Code:

<script>
var A=null;
var b="<html><head></head><body onkeydown='self.close()'>Press Any Key and I'll close this window.</body></html>";
function a()
{
A=window.open();
A.document.open();
A.document.write(b);
A.document.close();
}
</script>
<a href="javascript:a()">open new window</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *