Mouseover Creates New Window

[Total: 0    Average: 0/5]

This example shows how to have a mouse over open up a window.

Head Code:

<script>
var win= null;
function NewWindow(mypage,myname,w,h){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl;
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.focus();}
}
</script>

Body Code:

<a href="#" 
onmouseover="NewWindow('http://www.js-examples.com/', 'PopUp','500','500');return true" 
onmouseout="win.close(); return true;"><img src="http://www.js-examples.com/images/red_ball0.gif" border=0 width="100" height="105">
</a>

Times Viewed: 0

Leave a Reply

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