File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript 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 "JavaScript" Watch "JavaScript" New topic


satish polasi

Joined: Oct 15, 2003
Posts: 2
While giving alert to the user using javascript we have two buttons ok and cancel buttons, by default ok is selected, how to make cancel button by default.
please help me..

Rajesh Kumar

Joined: Oct 25, 2003
Posts: 6
The last time i checked this is not possible for the confirm
JS function
Here are some possible alternatives:
-creating your own custom popup layer(dhtml) to emulate confirm-dialog
that does the same thing and including the script into all your pages
-just pop-up a new 'small' browser window to do the confirm

just my 2 cents.
Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
you can write a line in onLoad() method as
Let me if ur needs are fulfilled

****************************<br />In 24 hrs Earth rotates once on its Axis.
Mathias Nilsson
Ranch Hand

Joined: Oct 13, 2003
Posts: 107
The above code won't work since the alert button Ok and cancel doesn't have
a name.
// Mathias

SCJP2 , MCP( 70-229 ) , Preparing For SCWDC
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

This has nothing to do with Servlets. I've requested a move to the HTML forum.

[Asking smart questions] [About Bear] [Books by Bear]
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
As said before, you can not make it default. Either you need to make yourown with layers, or just deal with the cancel button.
Don't get me started about those stupid light bulbs.
subject: JavaScript
jQuery in Action, 3rd edition