SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 
 

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.

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

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

Here is the demo of this code. Click the button below to display the confirm options .


Further readings
window.onload: for functions to execute as soon as page loads
Displaying alert window with message
prompt window for user input
Confirm window for user choice
Opening a child window
Closing child window on click of a button
Refreshing parent window from child window
Passing of data from child window to parent window
Showing a conformation window to user before deleting
Displaying JavaScript pop up window
Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.