SQL PHP HTML ASP JavaScript articles and free scripts to download

Displaying Confirm window for user input

We can display a confirm box to the visitor and ask their opinion. This confirm window will have two buttons, one for OK and other for CANCEL. Visitor can click one if the two buttons and the user action can be captured by assigning this to a variable. The confirm box will return TRUE if the OK button is clicked and it will return FALSE if cancel button is clicked.

We can further improve this by linking the returned value of the confirm button to an alert window.

Demo of window confirm

Here is the code for a confirm box linked to an alert window.

<html>
<head>
<title>Demo of Confirm window in JavaScript</title>
<META NAME="DESCRIPTION" CONTENT="Demo of Confirm window for user choice">
<META NAME="KEYWORDS" CONTENT="Demo Confirm window">
<link rel="stylesheet" href="../images/all11.css" type="text/css">
<script type="text/javascript">
function show_confirm() {

var my_string = confirm("Are you satisfied with the quality of the tutorials here?");
if(my_string){alert("Thank you");
}else{
alert("Please use the contact us page to give your feedbacks");}
}
</script>

</head>
<body>

<input type=button value='Click here to display confirm Window' OnClick="show_confirm()">
</body>
</html>


Google+

Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked




Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer