File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Can I change the buttons in a confirm alert box to 'Yes' , 'No'? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Can I change the buttons in a confirm alert box to Watch "Can I change the buttons in a confirm alert box to New topic
Author

Can I change the buttons in a confirm alert box to 'Yes' , 'No'?

san krish
Ranch Hand

Joined: Aug 11, 2010
Posts: 41
I have a requirement that requires a confirm box with 'yes' 'No' buttons.
But the default confirm box shows just 'OK', 'Cancel'.
How can i customize them? Im using javascript and Java.
Anyone who has experience in this, please guide me.
sample code would help.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not change the confirm, alert, or prompt.

You would have to build your own out of html and display it. Look at pre-built stuff like http://jqueryui.com/demos/dialog/#modal-confirmation
san krish
Ranch Hand

Joined: Aug 11, 2010
Posts: 41
Thanks for your reply.
But, I dont want to use JQuery. can I do the same in Javascript?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4420
    
    8

jQuery is JavaScript. So anything you can do with that is possible to do in plain JavaScript. It'll just be much harder, as you'll have to do the things that jQuery does for you by yourself.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

san nav wrote:But, I dont want to use JQuery.

Why not? Do you enjoy re-inventing the wheel? if not jQuery, why not Dojo? Or YUI?

Writing complex script on pages without the aid of one of the useful libraries is not wise. These tools abstract all the complexity and cross-browser nuances away for you.

If you write Java, do you use the Java collection classes? Or have you implemented your own List and Map implementations? Do you write your own JDBC driver?

Availing yourself of the available tools is a good practice.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30749
    
156

Adriano Ciz,
Your post was moved to a new topic.
I'm splitting the discussion about libraries into a new thread. It's a good discussion, but isn't about the original topic.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I change the buttons in a confirm alert box to 'Yes' , 'No'?