asp.net.ph

Skip Navigation Links

confirm Method

DHTML Methods


Displays a Confirm dialog box that contains the specified sMessage as well as OK and Cancel buttons.

Syntax

bChoice = window.confirm (  [ sMessage ] ) 
Parameters

sMessage Optional. String to display in the Confirm dialog box. If no value is provided, the dialog box will have no message.

Return Value

Boolean. Returns true if the user chooses OK, or false if the user chooses Cancel.

Remarks

The title bar of the Confirm dialog box cannot be changed.

Example

The following script will display a simple Confirm dialog box and store the user's choice to a variable named sure, which can then be used to trigger another function.

<script language="JavaScript">
function makeSureFirst ( ) {
   sure = confirm ( "Are you sure?" );
   if ( sure ) deleteMyWebSite ( );
}
</script>

 Show me 

Applies To

window

See Also

alert, prompt



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note