JavaScript Example (Program)
Learn Details

1. what is window open ?

Ans : इस method के द्वारा एक window se दूसरा window create करके open किया जाता है ।

Syntax

window.open("url_name/any_Link", "target", "spaces")

Example

  • url or link = https://www.teachcoders.com/ or about.html
  • target = _blank, _self, _parent
  • space = top:10, left:20

Example

HTML Code


   <html>	
	<!--head section-->
   <head>
      <title>Official Website Teach Coders</title>
		  <meta name="description" content="Teach Coders" />
		  <meta name="keywords" content="Teach Coders" />
   </head>

   <body>
    <button onclick="myfunc()">Open Window </button>
    <button onclick="closefunc()"> Close Window </button>

   </body>
</html>
   
  
----------------------------------------------------------
 EXAMPLE 1 : window open & close method
----------------------------------------------------------
 <script>
  var x;
  function myfunc(){
   x= window.open("https://www.teachcoders.com", "_blank", "width=700, height=500, top=200, left=500") //window open
  }
  
  function closefunc(){
    x.close; //window close
  }

</script>





 
 
  
  

Css Code


<style>
     

</style>