Window Manipulations

[Total: 0    Average: 0/5]

This shows how to create a window (popup) that can not be resized. It can be moved around by the user though. The content of the window can be dynamically altered by simple mouseOvers. The window can be closed by clicking the windows “X” or by clickin

Head Code:

<script type=text/javascript>
var x=200,y=200,w=250,h=200
var win // make this variable global.
function openWin(_txt) {
  if (win && win.open) {
    win.document.open();
	win.document.write(_txt);
	win.document.close();
  } else {
    win=window.open("javascript:'"+_txt+"'","","top="+y+",left="+x+",width="+w+",height="+h)
  }
}
function closeWin() {
  win.close();
  win = null;
}
</script>

Body Code:

Peas : 
<a href="javascript:void()" onMouseOver="openWin('Sample Pea Text')">mouse over for info</a>&nbsp;|&nbsp;
<a href="javascript:closeWin()">click to close</a>
<BR>
Beans :
<a href="javascript:void()" onMouseOver="openWin('Beany Text')">mouse over for info</a>&nbsp;|&nbsp;
<a href="javascript:closeWin()">click to close</a>

Times Viewed: 5

Leave a Reply

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