How can I do a button as defaulte selection

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi Friends,
I have six buttons in my screen. When ever the user enter into my
screen I would like make login button as the default one in the
screen. How can I do that? Can any of you please suggest me....

Thanks in advance.

Re: How can I do a button as defaulte selection

12.5.2011 13:41, Raju kirjoitti:

Quoted text here. Click to load it

The simplest method is to use the attribute
in the button element. This works even when scripting is off, though it
does not yet work on all browsers (e.g., IE - even IE 9 - does not
recognize the autofocus attribute).

You can use the older technique, the focus() method in Javascript,
though it has the drawback of not being overridable by users (as the
autofocus attribute is expected to be). It may also confuse the user if
the page e.g. has a text input box and the user has started typing
there, then the focus() method steals the focus.

You might combine the two techniques:

<body onload="init()">
<input id="login" type="button" value="Login" onclick="login()" autofocus>
function init(){
var login = document.getElementById("login");
if(!("autofocus" in login)) {
   login.focus(); }}

Yucca, /

Site Timeline