I feel itโ€™s always a good idea to explain whatever properties/attributes are mentioned. Here maybe a single line of what is href and why is it โ€œ#โ€ Answer from ๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป Varun Ganni on linkedin.com
๐ŸŒ
WisePops
wisepops.com โ€บ blog โ€บ html-popup
How to Create an HTML Popup [CSS, Javascript]
June 16, 2025 - Use event listeners to handle opening and closing the popup. document.addEventListener('DOMContentLoaded', function () { const popupOverlay = document.getElementById('popupOverlay');
๐ŸŒ
freeCodeCamp
forum.freecodecamp.org โ€บ html-css
Pop up window with HTML CSS JS - HTML-CSS - The freeCodeCamp Forum
April 19, 2021 - Hi guys, can you help me out, please, on how to create a pop up window like the one that welcomes you at t the following site: https://coolors.co/ . The idea will be displaying a pic when you arrive on the site (i was thinking about using js or jquery, maybe the: .onload or maybe $( document ).ready()) with black fading background and when you click on an โ€œXโ€ top right of the pic or anywhere else but on the image, the div disappear and youโ€™ll see the body content.
Discussions

How can you create a pop-up window with HTML and JavaScript?
Learn how to create a pop-up window with HTML and JavaScript in four simple steps. See a working example and customize it for your web pages. More on linkedin.com
๐ŸŒ linkedin.com
6
37
August 17, 2023
html - Create a popup window in plain javascript - Stack Overflow
In a specific page a user will press a button but on button press before the actual processing, I need occasionally to present to the user a list of options to select the appropriate one and use that More on stackoverflow.com
๐ŸŒ stackoverflow.com
Moodle in English: Help with sample HTML file for popup window content in a Lesson. | Moodle.org
The clickon will open a separate ... for example). But what I really want is for the window to be just a small explanatory text box that contains its own "clickon" link for more information that will redirect to another Moodle page. I'm just not sure how to make this html file or where to locate it in my moodle site. Does anyone have a sample javascript or html that ... More on moodle.org
๐ŸŒ moodle.org
Open window in JavaScript with HTML inserted - Stack Overflow
How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file? More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_js_popup.asp
How To Create Popups
Fullscreen Video Modal Boxes Delete Modal Timeline Scroll Indicator Progress Bars Skill Bar Range Sliders Color Picker Email Field Tooltips Display Element Hover Popups Collapsible Calendar HTML Includes To Do List Loaders Badges Star Rating User Rating Overlay Effect Contact Chips Cards Flip Card Profile Card Product Card Alerts Callout Notes Labels Ribbon Tag Cloud Circles Style HR Coupon List Group List Group with Badges List Without Bullets Responsive Text Cutout Text Glowing Text Fixed Footer Sticky Element Equal Height Clearfix Responsive Floats Snackbar Fullscreen Window Scroll Drawing
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ frames and windows
Popups and window methods
Help to translate the content of this tutorial to your language! ... A popup window is one of the oldest methods to show additional document to user. ... โ€ฆAnd it will open a new window with given URL.
๐ŸŒ
Mobiscroll
demo.mobiscroll.com โ€บ javascript โ€บ popup
Javascript Popup Examples | Mobiscroll
3 weeks ago - Pop-over examples with customizable content, button configuration and behavior. For vanilla JS to use everywhere. Last update: Feb 24, 2026
๐ŸŒ
HTML.com
html.com โ€บ javascript โ€บ popup-windows
Popup Windows Made Easy: Here's The JavaScript Code To Copy And Paste ยป
March 19, 2020 - This tutorial will walk you step-by-step through creating popup windows, including giving you a complete set of copy-and-paste JavaScript code. Weโ€™ll start with a basic example, showing the main pieces to a popup. Then weโ€™ll show the techniques for targeting a link inside the popup back to the main page.
Find elsewhere
๐ŸŒ
DHTMLX
dhtmlx.com โ€บ docs โ€บ products โ€บ dhtmlxPopup
JavaScript Popup Box - dhtmlxPopup
dhtmlxPopup is a free JavaScript component for displaying a neat popup box with any custom HTML content in it.
๐ŸŒ
MakeUseOf
makeuseof.com โ€บ home โ€บ programming โ€บ create a popup window using html, css, and javascript
Create a Popup Window Using HTML, CSS, and JavaScript
May 13, 2023 - You can create popup windows with HTML, CSS, and JavaScript. Use the following guide to create and style a popup window from scratch. It makes your website interactive and creates great user experiences. Let's write some HTML code that has a hidden modal window that pops up when you click a button. In this case, you will display the meaning of the word Hello! The popup window will have a heading and some content...
๐ŸŒ
PureBasic
purebasic.fr โ€บ home โ€บ board index โ€บ miscellaneous โ€บ off topic
Help with Javascript / html popup window - PureBasic Forums - English
September 23, 2022 - It opens the popup window and fills ... function popupwindow(url, windowName, w, h) { const x = window.top.outerWidth / 2 + window.top.screenX - ( w / 2); const y = window.top.outerHeight / 2 + window.top.screenY - ( h / 2); window.open(url,windowName,'width='+w+',height='+h+',top='+y+',left='+x+''); } </script> ...
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";
๐ŸŒ
Moodle
moodle.org โ€บ mod โ€บ forum โ€บ discuss.php
Moodle in English: Help with sample HTML file for popup window content in a Lesson. | Moodle.org
It's been a couple of days, but hope you can still take a look. I am attaching 3 images of the screens and one file containing the CSS and HTML. After quite a bit of frustration trying to get the <div>s to work with javascript, I took a different approach relying completely on CSS and HTML using an unordered list.
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_popup.asp
JavaScript Popup Boxes
JS Examples JS HTML DOM JS HTML Input JS HTML Objects JS HTML Events JS Browser JS Editor JS Exercises JS Quiz JS Website JS Syllabus JS Study Plan JS Interview Prep JS Bootcamp JS Certificate JS Reference ... An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed. ... The window.alert() method can be written without the window prefix.
๐ŸŒ
Your HTML Source
yourhtmlsource.com โ€บ html source โ€บ javascript โ€บ popup windows | open new customised windows with javascript
Popup Windows | open new customised windows with JavaScript
November 17, 2025 - Try it here: ยป Pop it ยท The HTML for that link simply called the function with the URL of the page we want to pop up as an argument. It looks like this: <a href="javascript:poptastic('/examples/poppedexample.html');">Pop it</a>
๐ŸŒ
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 - /* Popup box BEGIN */ .hover_bkgr_fricc{ background:rgba(0,0,0,.4); cursor:pointer; display:none; height:100%; position:fixed; text-align:center; top:0; width:100%; z-index:10000; } .hover_bkgr_fricc .helper{ display:inline-block; height:100%; vertical-align:middle; } .hover_bkgr_fricc > div { background-color: #fff; box-shadow: 10px 10px 60px #555; display: inline-block; height: auto; max-width: 551px; min-height: 100px; vertical-align: middle; width: 60%; position: relative; border-radius: 8px; padding: 15px 5%; } .popupCloseButton { background-color: #fff; border: 3px solid #999; border-rad
๐ŸŒ
TextFixer
textfixer.com โ€บ html โ€บ javascript-pop-up-window.php
Create a Javascript Popup Window
Although it's not a best practice to hide the scrollbars, here's a quick fix if you really want to do this for all browsers. //Add the following code to the HTML head of your pop-up: <style type="text/css"> body{overflow:hidden;} </style>
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-open-a-popup-on-click-using-javascript
How to Open a Popup on Click using JavaScript ? - GeeksforGeeks
August 5, 2025 - <!DOCTYPE html> <html> <head> <title>Using display property</title> <style> #popupDialog { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 20px; background-color: #fff; border: 1px solid #ccc; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); z-index: 1000; } #overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 999; } h1 { color: green; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h3>Using display property</h3> <button onclick="popupFn()"> Open Popup </button> <div id="overla
๐ŸŒ
Picreel
picreel.com โ€บ home โ€บ blog โ€บ popup implementation โ€บ html popup message: quick methods with codes & steps
HTML Popup Message Guide: HTML, CSS, and JavaScript (+Hack)
October 14, 2025 - HTML popup message explained: Step-by-step HTML, CSS & JavaScript guide with detailed codes. Plus an easy no-code option to design popups that convert better.
๐ŸŒ
Quackit
quackit.com โ€บ javascript โ€บ popup_windows.cfm
JavaScript Popup Windows
You can put the above code into a function, then call the function, passing the URL as a parameter, whenever you want to open a popup window. Doing this allows you to cut down on the amount of code you use when using popups. Here's a working example. ... The above script creates a function that accepts a parameter called "url". You can now call the function in your HTML as follows. ... Here, we create a normal HTML link, but we also add the onclick event handler to trigger our JavaScript function.