Write New Window – Close Opener

[Total: 0    Average: 0/5]

This shows how to open up a new window, and write the new page.

Body Code:

<script type=text/javascript>
var _w = null;
function createNew() {
  _w = window.open();
  _w.document.open();
  _w.document.write('<html><head><title>New Window</title></head><body>');
  _w.document.write('<a href="javascript:opener.close()">Close my opener!</a>');
  _w.document.write('</body></html>');
  _w.document.close();
}
</script>
<a href="javascript:createNew()">Create New Window</a>

Times Viewed: 3

Leave a Reply

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