How to Put a Popup Message on Your Website

by Shawn Farner

If you're a frequent Web browser, you've likely encountered a page with a popup alert box. Depending on your mood, you may have found this box annoying or you may have wondered how to implement it on your own page. If you're in the latter camp, you can learn how to create a JavaScript popup message box that visitors see when they visit your Web page. This task can be completed quickly.

Open the HTML file for your Web page in Notepad, the text application bundled with Windows.

Copy and paste the following code into your HTML file between the <body> and </body> tags: <script> function MYALERT() { alert("Insert your message here"); } MYALERT() </script>

Replace the "Insert your message here" text between the quotation marks with the message you want visitors to see when they get to your page.

Click "File," then click "Save" to save your changes. When you publish your updated page to the Web and visit in your Web browser, you'll be greeted with a popup message box containing the text you added.

About the Author

Shawn Farner is a graduate of Indiana University of Pennsylvania, receiving his Bachelor of Arts in English in 2008. His writing has appeared on CrunchGear.com, SlashGear.com and gizHQ.com. He currently resides in Harrisburg, Pa.