JavaScript Dialog box

Advertisements

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 Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements