mylink (the button's this) isn't a string, so you try to open mylink.href:

if (typeof(mylink) == 'string')
  href = mylink;
else 
  href = mylink.href;

But buttons don't have href properties, so it's as if you wrote:

window.open(undefined, 'about', 'width=400,height=200,scrollbars=yes');

which opens a blank page, as expected. If you want to open the same page as the link, use:

onclick="popup('newpopup.html', 'about');"
Answer from Paul Roub on Stack Overflow
๐ŸŒ
JavaScript.info
javascript.info โ€บ tutorial โ€บ frames and windows
Popups and window methods
In the past, evil sites abused popups a lot. A bad page could open tons of popup windows with ads. So now most browsers try to block popups and protect the user. Most browsers block popups if they are called outside of user-triggered event handlers like onclick.
๐ŸŒ
HTML.com
html.com โ€บ javascript โ€บ popup-windows
Popup Windows Made Easy: Here's The JavaScript Code To Copy And Paste ยป
March 19, 2020 - Note that the name should be in single quotes (โ€). Letโ€™s walk through the events that go into opening a popup. When the user clicks on a link, the browser triggers the onClick event, running the code in the onClick attribute.
๐ŸŒ
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
๐ŸŒ
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.
๐ŸŒ
Quackit
quackit.com โ€บ html โ€บ html_editors โ€บ scratchpad
Javascript Popup Window Onclick
Preview HTML code with this online HTML viewer. javascript popup window onclick.
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_js_popup.asp
How To Create Popups
Learn how to create popups with CSS and JavaScript. Click me to toggle the popup! A Simple Popup! ... <div class="popup" onclick="myFunction()">Click me!
๐ŸŒ
W3Schools
w3schools.com โ€บ js โ€บ js_popup.asp
JavaScript Popup Boxes
The window.alert() method can be written without the window prefix.
๐ŸŒ
QuirksMode
quirksmode.org โ€บ js โ€บ popup.html
JavaScript - Popups
First check if the browser supports ... the new window. ... Finally we return false. This is to prevent the browser from following the actual link. ... The normal link leads to the page you want to show, while the popup script is called in the onclick event handler. When the script is called, it returns false to prevent the browser from following the link. The trick is that when JavaScript is disabled ...
๐ŸŒ
W3docs
w3docs.com โ€บ learn-javascript โ€บ popups-and-window-methods.html
Mastering JavaScript: Comprehensive Guide to Popups and Window Methods
When clicked, it opens a new popup window with dimensions 400x400 pixels and displays a welcoming message. Controlling the content and behavior of popups is crucial for ensuring they contribute positively to the user experience without being ...
๐ŸŒ
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
๐ŸŒ
PopupSmart
popupsmart.com โ€บ popupsmart conversion rate optimization & digital marketing blog โ€บ how to build a popup that opens on a button click
How to Build a Popup That Opens on a Button Click
4 weeks ago - // Get the modal var modal = ... (event.target == modal) { modal.style.display = "none"; } This method creates a customizable modal popup that can be styled and animated....
๐ŸŒ
Laurentian
web.cs.laurentian.ca โ€บ rsgrewal โ€บ c2206 โ€บ javascript โ€บ examples โ€บ windows โ€บ windows.html
Opening a pop up window
Click to open a pop up window ยท This method uses the link. <a href="#" onclick="openPopUp('popUp.html')"> The use of # as the link means that no link is actually taken: the link is being used to execute a javascript function. Close pop up window and click the following link to open it again.
๐ŸŒ
C# Corner
c-sharpcorner.com โ€บ blogs โ€บ javascriptopen-new-popup-window-on-button-click-event1
Javascript-Open new Popup Window on button click event
April 29, 2020 - <script type="text/javascript"> function OpenNewWindow(MyPath) { window.open(MyPath,"","toolbar=no,status=no,menubar=no,location=center,scrollbars=no,resizable=no,height=500,width=657"); } </script> </head> <body bgcolor=#00ff00 alink=blue vlink=blue> <FORM name="windowEvent"> Enter Path Of File Or Window Which You Want To Open : <input type="text" name="txtpath"/> <input type="button" value="Open" name="btnOpenPopup" onClick="OpenNewWindow(txtpath.value)" /> </FORM> </body> </html> People also reading ยท
๐ŸŒ
Reddit
reddit.com โ€บ r/learnjavascript โ€บ how to trace down onclick event for popup window
r/learnjavascript on Reddit: How to trace down onclick event for popup window
January 3, 2022 -

At work we have a little 'notes' section for customers, this is tied to an onclick event that sends what I assume is an ajax request to pull data on that particular customer, then loads that into a popup window.

I've been searching for a way to just stuff whats inside that notes section(which is in plain text) into a text field on the page itself, without the business of having to click and load that popup each time. I have access to install tampermonkey for edge, which could let me do this, however I'm stuck at tracing down the ajax request.

I set a breakpoint under mouse click in sources, and F9 through what seems like endless jquery, never to find what I think would be a generic call(that would work on any customer page) that I need to plug into the request for that data. Since its the same domain, I don't expect any security roadblocks.

Is there a way to do this, or am I overcomplicating it? I also looked at .load() as well, but if I can't get that generic request, its fruitless i guess

๐ŸŒ
W3docs
w3docs.com โ€บ javascript
How to Create a Popup Form Using JavaScript
function openForm() { document.getElementById("loginPopup").style.display = "block"; } function closeForm() { document.getElementById("loginPopup").style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function (event) { let modal = document.getElementById('loginPopup'); if (event.target == modal) { closeForm(); } } It is not too difficult to have several Popup Forms use the data-*global attribute.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ API โ€บ Window โ€บ open
Window: open() method - Web APIs | MDN
Popups don't have a menu toolbar, whereas new tabs use the user interface of the browser window; therefore, many users prefer tab-browsing because the interface remains stable. Avoid <a href="#" onclick="window.open(โ€ฆ);"> or <a href="javascript:window\.open(โ€ฆ)" โ€ฆ>. These bogus href values cause unexpected behavior when copying/dragging links, opening links in a new tab/window, bookmarking, or when JavaScript is loading, errors, or is disabled.
๐ŸŒ
W3Schools
w3schools.com โ€บ howto โ€บ howto_css_modals.asp
How To Make a Modal Box With CSS and JavaScript
Learn how to create a Modal Box with CSS and JavaScript. A modal is a dialog box/popup window that is displayed on top of the current page: Open Modal
๐ŸŒ
PureBasic
purebasic.fr โ€บ home โ€บ board index โ€บ miscellaneous โ€บ off topic
Help with Javascript / html popup window - PureBasic Forums - English
September 23, 2022 - --> <html> <head> <title>Popup</title> <style type=text/css> .a11 {font-family:arial;font-size:11pt;font-weight:normal;color:#000000;} .button {width:75px;height:23px;} </style> </head> <body> <script language='javascript' type='text/javascript'> function doSubmit() { var doc = window.opener.document, theForm = doc.getElementById("theForm"), theForm.submit(); window.close(); } </script> <form id='theForm' action='popuptest.exe' method='get'> <p class='a11'>Choose:</p> <Select name='List' id='List' size='10' style='width:180;' class='a11' ondblclick='doSubmit()'> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> </Select> <br> <br> <input type='submit' name='send' value='Submit' onClick='doSubmit()'> &nbsp; <button class='button' onclick='javascript:window.close()'>Cancel</button> </form> </body> </html>