|
|
window.blur()We can lost focus from a window by using blur() method. Here is the syntax
window.blur();
Once the focus is lost then the window will be minimized ( not closed ) .
To get the window again we have to use window.focus()
You can see the source code of blur.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Demo of blur and focus of a window</title>
<script language=javascript>
function to_close(){
tm.close();
}
function to_open(){
tm=window.open("moveby-child.htm","Ratting","width=250,height=150,left=150,0,top=200,status=0,");
}
function to_focus(){
tm.focus(); // Keeping the focus on small window
}
function to_blur(){
tm.blur(); // Keeping the focus out on small window
}
</script>
</head>
<body>
<input type="button" name="btn" value="Open" onclick="to_open()";>
<input type="button" name="btn" value="Close" onclick="to_close()";>
<input type="button" name="btn" value="Focus" onclick="to_focus()";>
<input type="button" name="btn" value="Blur" onclick="to_blur()";>
</body>
</html>
The code for child window is available at moveBy
Found anything wrong or wants to improve the code by adding more features? Post your short comment here or use the Forum
| |
| | |
|
|
|
|
|