wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes setting Default Button 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 "setting Default Button" Watch "setting Default Button" New topic
Author

setting Default Button

Harry Chawla
Ranch Hand

Joined: Jun 03, 2000
Posts: 97
Hi
I was wondering if i can set a default button on my web page using Javascript or DHTML.
Any suggestions will be highly appreciated.
Thanks Bill for keeping it going.
Thanks.
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
There are two things you can do that I can think of. First is to setFocus on the button that you want to be the default, if you want to give it focus. Or if you are saying you want a certain button to respond with the enter key, like a default button, then you would need to capture the enter key and activate any function the button would have on the enter key.
What are you trying to do, have a form with two buttons like a reset and submit, but you want the submit button to be the default and not the reset?
I haven't looked too much into this, so there are probably better solutions that I have shown here. I'll try to look up some more when I get a chance.
Bill
 
 
subject: setting Default Button
 
Similar Threads
Change the html:submit button with an image button?????????
Problem with Jtable
How to align the Button's label?
Is there a way to automatically default a webpage to a specific area upon load?
JButton background color