Changes

JavaScript Window Object

712 bytes added, 18:38, 10 May 2007
Changing Window Focus
== Changing Window Focus ==
 
When a window is the currently selected window on the screen it is said to have ''focus''. Typically, clicking with the mouse pointer in a window gives that window focus. With JavaScript it is possible to programmitically change the focus of a window using the ''focus()'' and ''blur()'' methods. The following example displays a new window, blurs it so that the opening window still has focus and provides a button to switch focus to the new window:
 
<pre>
 
<script language="JavaScript" type="text/javascript">
 
newWindowObj = window.open ("", "MyWindow");
newWindowObj.blur();
 
</script>
 
<form action="null">
<input type="button" value="Focus New Window" onclick="newWindowObj.focus()" />
</form>
 
</pre>
== Displaying Message Box Dialogs ==