Open link in new window and focus - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open


Open link in new window and focus

Demo Code

ResultView the demo in separate window

      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function openWin(doFocus)/*  w  ww.j  ava  2 s  .  c  o m*/
    myWindow.document.write("<p>This is 'myWindow'</p>");

      <input type="button" value="Open window, focus" onclick="openWin(true)"> 
      <input type="button" value="Open window, nofocus" onclick="openWin()">  

Related Tutorials