Yes you need javascript. The simplest way is to just put this at the bottom of your HTML page:

<script type="text/javascript">
alert("Hello world");
</script>

There are more preferred methods, like using jQuery's ready function, but this method will work.

Answer from Adam Plocher on Stack Overflow
🌐
W3Schools
w3schools.com › howto › howto_js_alert.asp
How To Create an Alert Message Box
<div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span> This is an alert box. </div> If you want the ability to close the alert message, add a <span> element with an onclick attribute that says "when you click on me, hide my parent element" - which is the container <div> (class="alert"). Tip: Use the HTML entity "&times;" to create the letter "x".
🌐
W3Schools
w3schools.com › js › js_popup.asp
W3Schools.com
JS Examples JS HTML DOM JS HTML ... 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....
Discussions

HTML - Alert Box when loading page
i'm using HTML code and i wan't to show un Alert Message or alert box, i don't know what it is called, but a message with a "OK" button. i want to show this alert when the page is loaded. How do ... More on stackoverflow.com
🌐 stackoverflow.com
how to make a message box that sends message to email?
The mailto in the form action is what HTML gives you. As you have found it sucks and is not recommended. Your options are to write your own handler on the server side to get form data and send an email or use an API from a service provider that provides this type of request. You can google "form to email api" to find services that handle it a lot of them have a free option/tier. More on reddit.com
🌐 r/HTML
6
3
June 7, 2021
html - Create message box - Stack Overflow
I am trying to create a message box with a little piece on the side of it. Like this: I was able to implement it (with a hack, I'll explain later) with solid colors. If the message box has transpar... More on stackoverflow.com
🌐 stackoverflow.com
Html tags in alert box?
Hi all, I am running into problems with JS again :sick: The situation now is that I have a set of assesment quiz questions for my users and once they click ‘submit’, there will be a message box showing the results. Among wrong answers, I will want to include a link back to the relevant ... More on sitepoint.com
🌐 sitepoint.com
0
January 16, 2006
🌐
Quora
quora.com › How-do-you-create-a-message-box-in-HTML
How to create a message box in HTML - Quora
Answer (1 of 2): We can use in form tag to create a message box 1. 2. 3. 4. 5. Create the Text Box 6. 7. 8. 9. Hello User! 10.
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-dom-window-alert-method
HTML DOM Window alert() Method - GeeksforGeeks
The alert() method in HTML and JavaScript is used to display an alert box with a specified message.
Published   July 11, 2025
Find elsewhere
🌐
Wisej
docs.wisej.com › docs › controls › notifications › messagebox
MessageBox | Wisej.NET
February 25, 2025 - Displays a modal message box, also known as a dialog box, that can contain text, buttons, and symbols that inform and instruct the user.
🌐
GeeksforGeeks
geeksforgeeks.org › css › how-to-create-an-alert-message-box-using-css
How To Create an Alert Message Box using CSS? - GeeksforGeeks
October 9, 2024 - Display Messages: Each alert box displays a message tailored to its type (e.g., success, warning, error). Responsive Design: Using relative units and scalable font sizes ensures alerts adapt to different screens. Example: Here we are following the above-explained approach. ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Alert Message Boxes</title> <style> .alert { padding: 15px; margin-bottom: 20px; border-radius: 4px; font-size: 16px; font-weight: bold; } .success { color: #155724; background-colo
🌐
DHTMLX
dhtmlx.com › docs › products › dhtmlxMessage
JavaScript Message Box: alert, tooltip, confirmation - dhtmlxMessage
JavaScript Message box for displaying custom messages, tooltips, notifications, alerts, and confirm boxes.
🌐
Stack Overflow
stackoverflow.com › questions › 39443591 › create-message-box
html - Create message box - Stack Overflow
This is why you typically see the "tails" attached to the edges instead of the corners when using rounded boxes. You'll need an image or SVG to form the background. If you want the image/SVG to be dynamic, in that it resizes without distorting the corners, you'll need to arrange more complex HTML/CSS and provide either separate images or use in combination with something similar to a 9-patch graphic.
🌐
SheCodes
shecodes.io › athena › 52159-how-to-display-a-message-box-in-javascript-using-alert
[JavaScript] - How to display a message box in JavaScript using alert()
Learn how to display a message box in a browser using the alert() method in JavaScript, and also how to use JOptionPane to display a message box in Java programs.
🌐
Element Plus
element-plus.org › en-US › component › message-box
Message Box
By design MessageBox provides simulations of system's alert, confirm and prompt,so it's content should be simple. For more complicated contents, please use Dialog. Alert interrupts user operation until the user confirms. Open an alert by calling the ElMessageBox.alert method. It simulates the system's alert, and cannot be closed by pressing ESC or clicking outside the box.
🌐
W3Schools
www-db.deis.unibo.it › courses › TW › DOCS › w3schools › howto › howto_js_alert.asp.html
How To Create an Alert Message Box
<div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span> This is an alert box. </div> If you want the ability to close the alert message, add a <span> element with an onclick attribute that says "when you click on me, hide my parent element" - which is the container <div> (class="alert"). Tip: Use the HTML entity "&times;" to create the letter "x".
🌐
Medium
medium.com › @brajagopal.tripathi › how-to-create-a-message-box-in-html-b543795fe0e9
How to create a message box in HTML? | by Brajagopal Tripathi | Medium
September 9, 2023 - How to create a message box in HTML? There are two ways to create a message box in HTML: Using the tag Using JavaScript Using the tag The tag defines a dialog box or …
🌐
SitePoint
sitepoint.com › javascript
Html tags in alert box?
January 16, 2006 - Hi all, I am running into problems with JS again :sick: The situation now is that I have a set of assesment quiz questions for my users and once they click ‘submit’, there will be a message box showing the results. Among wrong answers, I will want to include a link back to the relevant ...
🌐
Uw
projects.accesscomputing.uw.edu › webd2 › student › unit5 › module2 › lesson1.html
Using JavaScript to Show an Alert
Most programming or scripting languages are similar to one another, including PHP and JavaScript, but there are subtle differences in their syntax (the rules of how the code must be written). One useful function that's native to JavaScript is the alert() function. This function will display ...
🌐
Speckyboy
speckyboy.com › home › css › 10 free css & js notification alert code snippets
10 Free CSS & JS Notification Alert Code Snippets for Web Designers
February 5, 2025 - Simply titled formrun.js this uses a pure CSS dialog modal to handle error messages when submitting a login form. The best part is that you can apply this to pretty much any form like checkout pages or user settings pages. Here’s a fun little alert box created from scratch by developer Luca Moser.
🌐
UNODC
unodc.org › misc › treaties › ext › docs › output › MessageBox.jss.html
MessageBox.js
* @param {Number} value Any number between 0 and 1 (e.g., .5) * @param {String} text (optional) If defined, the message box's body text is replaced with the specified string (defaults to undefined) * @return {Ext.MessageBox} This message box */ updateProgress : function(value, text){ if(text){ this.updateText(text); } pp.setWidth(Math.floor(value*progressEl.dom.firstChild.offsetWidth)); return this; }, /** * Returns true if the message box is currently displayed * @return {Boolean} True if the message box is visible, else false */ isVisible : function(){ return dlg && dlg.isVisible(); }, /** * Hides the message box if it is displayed */ hide : function(){ if(this.isVisible()){ dlg.hide(); } }, /** * Displays a new message box, or reinitializes an existing message box, based on the config options * passed in.
🌐
Python
docs.python.org › 3 › library › tkinter.messagebox.html
tkinter.messagebox — Tkinter message prompts
The tkinter.messagebox module provides a template base class as well as a variety of convenience methods for commonly used configurations. The message boxes are modal and will return a subset of (True, False, None, OK, CANCEL, YES, NO) based on the user’s selection.