-->

Wednesday, September 30, 2015

Open and close new window using JQuery

Open and close new window using JQuery

Introduction
In this article i will show you how to open new window when we click on button using JQuery. I will give an example of it. Also do some thing like when we click on other button then opened new window will closed also mentioned in the example.

Description
I have explained Get browser details using JQuery, Button work as fileupload control in JQuery.
Source code
<!DOCTYPE html>
<html>
<head>
    <title> OPen and close window using JQuery </title>
</head>
<body>

    <form name="form1">
        <input type="button" value="Open New Window" id="btnOpen" />
        <p> <input type="button" value="Close New Window" id="btnClose" />

    </form>
    <script src="https://code.jquery.com/jquery-2.1.4.js"></script>
    <script type="text/javascript">
     
        var Window1;
        $(function () {
            $(form1.btnOpen).click(function () {
                Window1 =  window.open('', 'YourWindow', 'height=500,width=500');
            });
            $(form1.btnClose).click(function () {
                Window1.close();
            });
        });

   
 
    </script>
</body>
</html>
Code Generate the following output
Open and close new window using JQuery

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved