🌐
W3Schools
w3schools.com › js › js_popup.asp
JavaScript Popup Boxes
To display line breaks inside a popup box, use a back-slash followed by the character n. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
Mobiscroll
demo.mobiscroll.com › javascript › popup
Javascript Popup Examples | Mobiscroll
Pop-over examples with customizable content, button configuration and behavior. For vanilla JS to use everywhere. Last update: Feb 24, 2026
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › what-are-the-types-of-popup-box-available-in-javascript
What are the types of Popup box available in JavaScript ? - GeeksforGeeks
August 5, 2025 - It is triggered by the prompt() function, which displays a message and input field, allowing the user to provide a response or cancel. ... Example: This example we displays a button that triggers a prompt box using JavaScript.
🌐
W3Schools
w3schools.com › howto › howto_js_popup.asp
How To Create Popups
Create a Website Make a Website Make a Static Website Host a Static Website Make a Website (W3.CSS) Make a Website (BS3) Make a Website (BS4) Make a Website (BS5) Create and View a Website Create a Link Tree Website Create a Portfolio Create a Resume Make a Restaurant Website Make a Business Website Make a WebBook Center Website Contact Section About Page Big Header Example Website · 2 Column Layout 3 Column Layout 4 Column Layout Expanding Grid List Grid View Mixed Column Layout Column Cards Zig Zag Layout Blog Layout · Google Charts Google Fonts Google Font Pairings Google Set up Analytics · Convert Weight Convert Temperature Convert Length Convert Speed · Get a Developer Job Become a Front-End Dev. Hire Developers ... Learn how to create popups with CSS and JavaScript.
🌐
Quackit
quackit.com › javascript › tutorial › javascript_popup_boxes.cfm
JavaScript Popup Boxes
To create a JavaScript confirm box, you use the confirm() method. Here's an example: Prompts the user for information. Example: To create a JavaScript prompt, you use the prompt() method. Here's an example: Note that the user's browser determines what the popup box actually looks like.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-create-popup-box-using-html-css-and-javascript
How to create Popup Box using HTML CSS and JavaScript? - GeeksforGeeks
In JavaScript, first, get button elements through their id or class and then apply addEventListener on the Popup button as well as the Close button. "Click" event is used, popup box appears while clicking on the popup button.
Published   August 5, 2025
🌐
Dot Net Tutorials
dotnettutorials.net › home › javascript popup boxes
JavaScript Popup Boxes with Examples - Dot Net Tutorials
June 30, 2020 - In this article, I am going to discuss JavaScript Popup Boxes with Examples. JavaScript has 3 types of popup boxes.Alert box, Confirmation box, & Prompt box
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › javascript popup box
JavaScript Popup Box | Learn 3 Types of Popup Box in JavaScript
June 13, 2023 - ... Example: While you are filling online application, it asks you for your date of birth; then you enter your date of birth, but if you enter the wrong date of birth, then it will show a popup Box.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Codingem
codingem.com › home › javascript popup boxes
JavaScript Popup Boxes - codingem.com
July 10, 2025 - alert("Enable JavaScript to Continue on the Site!"); ... The confirmation popup box is used to display a dialog with a message and two buttons, “OK” and “Cancel”. To create a confirmation box, use the built-in confirm() method.
Find elsewhere
🌐
Js
popup.js.org
popup-js
Create a new popup by instantiating the Popup class: const myPopup = new Popup({ id: "my-popup", title: "My First Popup", content: ` An example popup.
🌐
Medium
medium.com › @ladypenguin1991 › javascript-popup-boxes-1b26d0aa89dc
Javascript Popup Boxes. I believe I can comfortably say that… | by CynthiaHarris | Medium
April 16, 2023 - To start this article, I’m going ... let’s take a look at three different kinds of Javascript popup boxes: alert(), confirm(), and prompt()....
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › js › js_popup.asp.html
JavaScript Popup Boxes
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Quiz JS Certificate JS Summary ... JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box.
🌐
TutorialsTeacher
tutorialsteacher.com › javascript › display-popup-message-in-javascript
JavaScript Message Boxes: alert(), confirm(), prompt()
alert("This is an alert message box."); // display string message alert('This is a numer: ' + 100); // display result of a concatenation alert(100); // display number alert(Date()); // display current date ... Use the confirm() function to take the user's confirmation before starting some task. For example, you want to take the user's confirmation before saving, updating or deleting data. ... The confirm() function displays a popup message to the user with two buttons, OK and Cancel...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Mozilla › Add-ons › WebExtensions › user_interface › Popups
Popups - Mozilla | MDN
This page describes popups in general, ... well as examples of use. When the user clicks the button, the popup is shown. When the user clicks anywhere outside the popup, the popup is closed. The popup can be closed programmatically by calling window.close() from a script running in the popup. However, you can't open the popup programmatically from an extension's JavaScript; it can be ...
🌐
HTML Online
html-online.com › home › a very simple popup box – html, css, javascript
A Very Simple Popup Box - HTML, CSS, JavaScript
July 6, 2025 - Use the iframe below to test the live demo: Add a link that triggers the box and a div that behaves like the box shadow. This wraps the actual box with the close button. The helper span is used to center the box vertically.
Top answer
1 of 2
8

Here is a simple solution that will allow you to fetch value from opened window. All you need is to inject JavaScript code into opened window that will interact with the parent window using window.opener:

HTML

<input id="value" />
<button onclick="openWindow();">Open</button>

JavaScript

function openWindow() {
    var i, l, options = [{
       value: 'first',
       text: 'First'
    }, {
       value: 'second',
       text: 'Second'
    }],
    newWindow = window.open("", null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");  

    newWindow.document.write("<select onchange='window.opener.setValue(this.value);'>");
    for(i=0,l=options.length; i<l; i++) {
        newWindow.document.write("<option value='"+options[i].value+"'>");  
        newWindow.document.write(options[i].text);  
        newWindow.document.write("</option>");
    }
    newWindow.document.write("</select>");
}

function setValue(value) {
    document.getElementById('value').value = value;
}

Working example here: http://jsbin.com/uqamiz/1/edit

2 of 2
2

The easiest way is to have a superimposed div with a a high z-index, with transparent background acting as an overlay. You could then have another div which is centered above the overlay(with higher z-index) and containing the list markup

CSS

#shim {
opacity: .75;
filter: alpha(opacity=75);
-ms-filter: "alpha(opacity=75)";
-khtml-opacity: .75;
-moz-opacity: .75;
background: #B8B8B8;
position: absolute;
left: 0px;
top: 0px;
height: 100%;
width: 100%;
z-index:990
}

#msgbx {
position: absolute;
left: 50%;
top: 50%;
height: 150px;
width: 350px;
margin-top: -75px;
margin-left: -175px;
background: #fff;
border: 1px solid #ccc;
box-shadow: 3px 3px 7px #777;
-webkit-box-shadow: 3px 3px 7px #777;
-moz-border-radius: 22px;
-webkit-border-radius: 22px;
z-index:999
}

HTML

<div id="shim"></div>
<div id="msgbx">inject list markup here</div>

To show popup

document.getElementById('shim').style.display=document.getElementById('msgbx').style.display ="block";

To Hide

document.getElementById('shim').style.display=document.getElementById('msgbx').style.display ="none";
Top answer
1 of 4
2

It can be very easily done using pure CSS and JS...

Please find here the fiddle - Please let me know if this helps.

Your popup html code can be like-

<div id="click" onClick="showPopUp()">Click here to see the pop up</div>
<div id="popup">
    <div id="header">Welcome to Pop-Up
        <img src="http://icongal.com/gallery/image/158734/actions_window_close.png" width="20px" onclick="closeThis()" />
    </div>
    <div>THIS IS THE TEXT OF POP-UP</div>
</div>

Basic CSS -

#popup {
    position:absolute;
    display: none;
    left:50%;
    top:10px;
}

JS Code -

1) To Show the popup on click of the text

    function showPopUp() {
        document.getElementById("popup").style.display = "block";
    }

2) To check/hide a pop up when clicked anywhere else on the page -

    document.onclick=check;
    function check(e) {
            var target = (e && e.target) || (event && event.srcElement);
            var obj = document.getElementById('click');
            if(target!=obj){document.getElementById('popup').style.display='none'}
    }
2 of 4
0

I put together an overly simplistic jsFiddle demo of how a popup is made. Here is the magic:

//Display Popup method - you can modify this to add parameters 
function displayPopup(event) {
        //dynamically create a div, button, and inner text
        var p = document.createElement('div'),
            b = document.createElement('button'),
            t = document.createTextNode("Text and stuff");

    //add popup class to newly created div
    p.className += 'popup';
    //Add text to close button element
    b.innerHTML = "close";
    //Append text to popup div
    p.appendChild(t);
    //Bind click event to button element
    b.onclick = closePopup;
    //Append button to popup div, and append popup to document body
    p.appendChild(b);
    document.body.appendChild(p);

    p.style.display="block";

    //This function hides the popup
    function closePopup(event){
        p.style.display="none";
    }
}

It should by no means be considered complete or production material, but I hope it helps you get started on the right path to extending it to achieve the functionality you're looking for.

🌐
Studytonight
studytonight.com › javascript › javascript-popup-boxes
JavaScript Popup Boxes - Studytonight
So, for important actions, we should use the confirm popup box. JavaScript Prompt box can be used to create a menu like system where based on user input different actions are performed using the JavaScript switch statement. Let's take a simple code example to demonstrate this: