*
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
Author

JavaScript

satish polasi
Greenhorn

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..

thanks
satish
Rajesh Kumar
Greenhorn

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.
-Rajesh
Amit KumarS
Ranch Hand

Joined: Oct 10, 2003
Posts: 100
hi..
you can write a line in onLoad() method as
document.<formname>.<buttonname>.focus()
Let me if ur needs are fulfilled
Thnaks
Amit


****************************<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
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
As said before, you can not make it default. Either you need to make yourown with layers, or just deal with the cancel button.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript