views:

232

answers:

4

Hi All, an anyone tell how can i make a button on page onload.As i have a login page and i want to make the login button selected onload and when i press eneter the onclick of button should be called. I want to do this in chorme. Thanks

+1  A: 

yes you can use the focus function to set the focus the your button

Ahmed Khalaf
A: 

I don't know f it's different for chrome, but while the user is editing any form the enter button should automatically click the Submit button

Kheu
A: 

If you are using asp.net try asp panel's default button property to ur button and thats it....

Pandiya Chendur
+1  A: 

try this:

<script>
  window.onload=function(){
    document.getElementById('YourButtonId').focus();
  }
</script>
Pedro Ladaria