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
🌐
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"> ... To Open : <input type="text" name="txtpath"/> <input type="button" value="Open" name="btnOpenPopup" onClick="OpenNewWindow(txtpath.value)" /> </FORM> </body> </html> People also reading ...
People also ask

Is Popupsmart Compatible with CMS to Display Popup Campaign?
Yes, it is. When you decide to create and publish your popup, all you need to do is customize your campaign and make sure that your embed code is working properly on your website.
🌐
popupsmart.com
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
How Can I Ensure a Seamless UX with Popups?
Focusing on the timing and relevance of your popups is essential. Utilize the features to allow users to initiate interactions when they are ready, reducing the likelihood of interrupting their browsing experience.
🌐
popupsmart.com
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
Can I Track the Performance of My Popups?
Yes, Popupsmart provides Leads and Analytics pages, where you can monitor metrics such as conversion rates, click-through rates, and engagement data to assess the effectiveness of your popups and make data-driven improvements.
🌐
popupsmart.com
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
🌐
JavaScript.info
javascript.info › tutorial › frames and windows
Popups and window methods
Each window has a window.name, and here we can specify which window to use for the popup. If there’s already a window with such name – the given URL opens in it, otherwise a new window is opened. ... The configuration string for the new window. It contains settings, delimited by a comma. There must be no spaces in params, for instance: width=200,height=100. ... left/top (numeric) – coordinates of the window top-left corner on the screen.
🌐
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
January 26, 2024 - Create an event listener for the button click event, and use it to toggle the visibility of the popup by changing its display property. You can use JavaScript to add the functionality to open the modal when the button is clicked and to close ...
🌐
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 - In this approach, we will use the classList property with toggle() method in JavaScript to toggle the visibility of the overlay and popup dialog elements. The openFn() function dynamically adds or removes the 'hidden' class, while adjusting ...
🌐
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!
Find elsewhere
🌐
YouTube
youtube.com › watch
Open a new window in JavaScript on button click and Focus ...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
Linux Hint
linuxhint.com › open-a-popup-window-in-javascript-using-onclick
How to Open a Popup Window in JavaScript Using Onclick?
Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
YouTube
youtube.com › web dev simplified
Build a Popup With JavaScript - YouTube
If you have used the web anytime in the last 5 years then you have most definitely run into an abundance of popups, also known as modals, which are quickly b...
Published   April 20, 2019
Views   88K
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › API › Window › open
Window: open() method - Web APIs | MDN
These features include options such as the window's default size and position, whether or not to open a minimal popup window, and so forth. The following options are supported: ... Indicates that you want the browser to send an Attribution-Reporting-Eligible header along with the open() call. This call must be made with transient activation (i.e., inside a user interaction event handle such as click), within five seconds of user interaction.
🌐
Quora
quora.com › How-do-you-create-a-new-popup-window-in-JavaScript
How to create a new popup window in JavaScript - Quora
Answer (1 of 2): I would suggest you to use window.open() Here is the syntax and parmeter of window.open(): window.open(URL, windowName, [windowFeatures]) URL: The URL of the page to open.
🌐
W3docs
w3docs.com › learn-javascript › popups-and-window-methods.html
Mastering JavaScript: Comprehensive Guide to Popups and Window Methods
The primary method to create a popup in JavaScript is through the window.open() method. To create a simple popup window, you can use the window.open() function. This method can open a new browser window and return a reference to it, which can ...
🌐
CodePen
codepen.io › marine-fraysse › pen › eYmBEvQ
Pop-up on Button Click
Button which brings up a pop-up overlay when clicked....
🌐
HTML.com
html.com › javascript › popup-windows
Popup Windows Made Easy: Here's The JavaScript Code To Copy And Paste »
March 19, 2020 - A tutorial on creating 'popup window' web pages. Includes ready code and working examples. These techniques work around the many common problems with popup windows.
🌐
WisePops
wisepops.com › blog › popup-on-a-button-click
How to make a popup that opens on a button click [+examples]
Learn how to create a popup that opens on a button click, or an on-click popup form.