Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 6th, 2003, 10:58 AM
An An is offline
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to default confirm box to NO in javascript.

The following script show the confirm box and pop the Mesage when someone click delete button and press ENTER key.(Default to OK)

Is there a way to default the javascript confirmbox to Cancel instead?



<SCRIPT LANGUAGE="Javascript">
<!---
function decision(){
if(confirm("Are you sure to delete?")) { alert("you click DELETE");
}
// --->
</SCRIPT>

<FORM NAME="f"> <INPUT
TYPE="button" VALUE="Delete" NAME="button1"
ONCLICK="decision()">
</FORM>
  #2 (permalink)  
Old June 8th, 2003, 07:34 AM
Friend of Wrox
Points: 1,315, Level: 14
Points: 1,315, Level: 14 Points: 1,315, Level: 14 Points: 1,315, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

No, you can't do that. Fact is you can't change the appearance of built-in dialog windows at all.

It's all for the best. Imagine a blind user or just a sloppy one like me. I expect the default to be "OK" because it always is. It could be very confusing if it wasn't and cause a lot of mistakes. :)

(o<
//\ =^..^=


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript confirm box with just an 'OK' button crmpicco Javascript How-To 28 March 12th, 2014 06:44 AM
JavaScript Confirm Box ricespn Classic ASP Basics 1 January 20th, 2007 12:48 AM
Javascript Confirm Message box itHighway Javascript How-To 5 September 25th, 2006 02:51 AM
need Confirm() with Yes/No buttons in JavaScript ehelpcornet ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 07:32 AM
Confirm alert box - need help, Please! larry HTML Code Clinic 1 January 25th, 2004 02:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.