Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to create a pop up in middle screen javascript

<!DOCTYPE html>
<html>
     
<head> 
    <title> 
        Centered popup window
        on the screen
    </title>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
     
    <p>
        Centered popup window
        on the screen
    </p>
     
    <script>
        function createPopupWin(pageURL, pageTitle,
                    popupWinWidth, popupWinHeight) {
            var left = (screen.width - popupWinWidth) / 2;
            var top = (screen.height - popupWinHeight) / 4;
             
            var myWindow = window.open(pageURL, pageTitle,
                    'resizable=yes, width=' + popupWinWidth
                    + ', height=' + popupWinHeight + ', top='
                    + top + ', left=' + left);
        }
    </script>
     
    <button onclick = "createPopupWin('https://www.geeksforgeeks.org',
            'GeeksforGeeks Website', 1200, 650);">
        GeeksforGeeks
    </button>
</body>
 
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: get input js 
Javascript :: export javascript 
Javascript :: how-to-reset-a-form-using-jquery 
Javascript :: radio button checked jquery 
Javascript :: volume slider javascript 
Javascript :: at leastone checkbox required jquery 
Javascript :: how to write a javascript function 
Javascript :: let var 
Javascript :: static js 
Javascript :: react detect page width 
Javascript :: get javascript component position 
Javascript :: js new element 
Javascript :: hashtable js 
Javascript :: check a date is between two dates in javascript 
Javascript :: operators in js 
Javascript :: convert string to camelcase 
Javascript :: react build blank page 
Javascript :: try and catch express 
Javascript :: select the items from selectors in .map reactjs 
Javascript :: how to create a website with javascript 
Javascript :: all redux reuired packages 
Javascript :: react native refresh flatlist on swipe down 
Javascript :: hasownproperty javascript 
Javascript :: how to toggle navbar using javascript 
Javascript :: node.js error handling process 
Javascript :: extract from a string in javascript 
Javascript :: js nuxt read/set cookie 
Javascript :: for:each in lwc js 
Javascript :: fizz buzz program in javascript 
Javascript :: javascript find the longest word in a string 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =