JavaScript Dialog box


Prev Tutorial Next Tutorial

JavaScript Dialog box

All JavaScript dialog box is a predefined function which is used for to perform different-different task. Some function are given below;

functionDiscription
alert()To give alert message to user.
prompt()To input value from used.
confirm()To get confirmation from user before executing some task.

Alert()

Alert function of java script is used to give an alert message to the user.

Alert function example

Example

<!doctype html>
<html>
<head>
<script>
function alertmsg()
{
alert("Alert function call");
}
</script>
</head>
<form>
<input type="button" value="Click Me" onclick="alertmsg()"/>
</form>
</html>

Result

prompt()

Prompt function of java script is used to get input from the user.

prompt() function example

Example

<!doctype html>
<html>
<head>
<script>
function alertmsg()
{
a=prompt("Enter your name:");
alert(a);
}
</script>
</head>
<form>
<input type="button" value="Click Me" onclick="alertmsg()"/>
</form>
</html>

Result

confirm()

confirm function of java script is used to get confirmation from user before executing some task.

confirm() function example

Example

<!doctype html>
<html>
<head>
<script>
function alertmsg()
{
a=prompt("Enter your name:");
confirm(a);
}
</script>
</head>
<form>
<input type="button" value="Click Me" onclick="alertmsg()"/>
</form>
</html>

Result


Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements