Monday, 21 May 2012

how to open a new window in javascript

<script type= "text/javascript">
    $(document).ready(function () {
        $("#<%=LnkSelectName.ClientID %>").click(function () {
            var width = 400;
            var height = 250;
            var left = (screen.width - width) / 2;
            var top = (screen.height - height) / 2;
            var params = 'width=' + width + ', height=' + height;
            params += ', top=' + top + ', left=' + left;
            params += ', directories=no';
            params += ', location=no';
            params += ', menubar=no';
            params += ', resizable=yes';
            params += ', scrollbars=no';
            params += ', status=no';
            params += ', toolbar=no';
            newwin = window.open('NewWindow.aspx', 'windowname5', params);
            if (window.focus) { newwin.focus() }
            return false;

        });
    });
</script>

No comments:

Post a Comment