Use window.open inside the window.load function event - Javascript DOM

Javascript examples for DOM:Event

Description

Use window.open inside the window.load function event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script ="text javascript">
function check() {//from  w w w.  j a v a  2s .  c o  m
   var txtfield; txtfield =document.getElementById('txtbox').value;
   if(txtfield == "run")
   { 
     console.log("you entered string right");
     var newwin=window.open('http://java2s.com','welcome','width=500,height=500,menubar=yes,status=yes,location=yes,toolbar=yes');
     newwin.focus();
   }
   else { 
     console.log("Try again"); 
   }
}
 
      </script> 
   </head> 
   <body>
       Enter a Keayword 
      <input type="text" id="txtbox" onblur="check()">  
   </body>
</html>

Related Tutorials