Contact Us

Scripts: Javascript :: Forms :: Library Article #10

Developer's Section

Display Alert / Prompt Boxes
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (2775)

Learn to display simple alert messages and prompt boxes in your html forms.

In this tutorial we will learn how to display simple alert messages and prompt messages using two simple javascript methods.

Our goal is to use this functionality:

Here is the code:

 Code Snippet 1

<script language="Javascript">

function DisplayAlert() {
    alert("My first Alert Message!!")

function DisplayPromptBox() {

var input=prompt("Enter Text Below:","");
    if (input!=null && input!=""){
        alert("Your wrote:" + input)


<form name="thisForm" action="yourpage.xhtml" method="POST" >

<table border="1" style="border:collapse">
     <td><input type="button" name="trigger1" value="Display Alert Message"
<td><input type="button" name="trigger1" value="Display Prompt Box"

See other Scripts in Forms


Submit Your Scripts:

If you would like to have your Javascripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]