Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
window.focus() Method in Window Object of Javascript Syntax with Examples
2678 Views
Usage 
The focus() method is used to set focus to specific window.
Syntax 
myWindow.focus();
Example
<button onclick="javascript:showwindow();">show window</button>
var myWindow = window.open("http://www.knowledgewalls.com","","width=800,height=300");

function showwindow(){
  myWindow.focus();
}
Output 
Once we click Show window button,new window will get focused and visible in front.
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details