please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Window.confirm() Method

Name

Window.confirm() Method---ask a yes-or-no question

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

window.confirm(question)

Arguments

question

The plain text (not HTML) string to be displayed in the dialog. It should generally express a question you want the user to answer.

Returns

true if the user clicks the OK button, or false if the user clicks the Cancel button.

Description

The confirm() method displays the specified question in a dialog box that pops up over window. The appearance of the dialog is platform-dependent, but it generally contains graphics that indicate that the user is being asked a question. The dialog contains OK and Cancel buttons that the user can use to answer the question. If the user clicks the OK button, then confirm() returns true. If the user clicks Cancel, then confirm() returns false.

The dialog box that is displayed by the confirm() method is modal--that is, it blocks all user input to the main browser window until the user dismisses the dialog by clicking on the OK or Cancel buttons. Since this method returns a value depending on the user's response to the dialog, JavaScript execution pauses in the call to confirm() and subsequent statements are not executed until the user responds to the dialog.

Usage

Note that the question displayed in the dialog is a string of plain text, not formatted HTML. You can use the newline character, \n, in your strings to break your question across multiple lines. You can also do some very rudimentary formatting using spaces and can approximate horizontal rules with underscore characters, but the results you achieve will depend greatly on the font used in the dialog, and will thus be system dependent.

Also, there is no way to change the labels that appear in the buttons of the dialog box (to make them read "Yes" and "No", for example). Therefore, you should take care to phrase your question or message in such a way that "OK" and "Cancel" are suitable responses.

See Also

"Window", "Window.alert()", "Window.prompt()"


Previous Home Next
Window.closed Book Index Window.defaultStatus

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_434.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/24 18:29,
TOP NEW HELP FIND: 
3.135.214.139:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/TECHREF/language/java/script/definitive/refp_434.htm"> [Chapter 21] Reference: Window.confirm()</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .