Products
Services
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: (1690)
Favorites:

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)
    }
}

</script>

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

<table border="1" style="border:collapse">
<tr>
     <td><input type="button" name="trigger1" value="Display Alert Message"
      onclick="javascript:DisplayAlert()"></td>
</tr>
<tr>
<td><input type="button" name="trigger1" value="Display Prompt Box"
      onclick="javascript:DisplayPromptBox()"></td>
</tr>
</table>
    
</form>


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:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]