Open New Windows

[Total: 0    Average: 0/5]

This shows how to open a window on a mouseover, on a mouseout, or on a href-click.

Body Code:

<script type=text/javascript>
// this code will receive an error if the user
// clicks the "X" to close the pop up....
// otherwise it knows not to open it again, or
// that it needs to open it...
var _winObj;
function doIt() {
  if (_winObj || _winObj != null) {
    return;
  }
  _winName = "MyNewWindow";
  _info =  "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,dependent,height=300,width=420,left=0,top=0";
  urlLoc = "";
  _winObj=window.open(urlLoc,_winName,_info);
  _winObj.document.write('This is my new window.<BR>');
  _winObj.document.write('<a href="javascript:opener._winObj=null;this.close()">Close Me</a><BR>');
  _winObj.document.write('<img src="http://www.js-examples.com/js/pic1.gif" border=0 alt="my PIC">');
} 
</script>

<a href='javascript:doIt()'>Click Here To Open New Window</a><BR><BR>
<a href='#' onmouseover='doIt()'>Mouse-Over To Open New Window</a><BR><BR>
<a href='#' onmouseout='doIt()'>Mouse-Out To Open New Window</a>

Times Viewed: 0

Leave a Reply

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