HOW TO OPEN AND CLOSE WINDOW USING WINDOW OBJECT IN JAVASCRIPT

 HOW TO OPEN AND CLOSE WINDOW USING WINDOW OBJECT IN JAVASCRIPT


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Testing Javsript</title>

</head>
<body >
 
<button onclick="func1()">CLICK ME TO OPEN GOOGLE</button>
<button onclick="func2()">CLOSE GOOGLE</button>

<script>
    var a ;
function func1()
{
     a =  window.open("http://www.google.com",
    "_blank","width=200px,height=200px,left=100px,top=50px");
}

function func2()
{
      a.close();
}

</script>

</body>
</html>
 
 

 

Comments

Popular posts from this blog