Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Html Grab focus ?

Options
  • 10-11-2005 4:38pm
    #1
    Registered Users Posts: 261 ✭✭


    Anyone know how to grab focus to a html form like google those to its search text box ?

    I tried to view the sourse i cant make much sense of it, I think they might use java script , anyone got any ideas ?


Comments

  • Closed Accounts Posts: 5,372 ✭✭✭The Bollox


    it's a very simple thing, I can't remember what it was, all I know was that it was just a simple command like < align> or something like that


  • Moderators Posts: 6,861 ✭✭✭Spocker


    Add the following in the <body> tag of your page:

    onLoad="document.form.element.focus()"

    where form is the name of the form and element is the name of the element you want the focus to be on.

    HTH

    S.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    It's Javascript.

    <body onLoad = "javascript:document.getElementById('myTextField').focus()">


  • Registered Users Posts: 261 ✭✭HaVoC


    sweet thanks guys


Advertisement