0

I'm editing a start page made by someone else (found here: http://defined04.deviantart.com/art/KMay-Start-Page-184915031?q=gallery%3Adefined04%2F790342&qo=0). This lets you switch search engines by clicking on the different tabs. Is there a way to have the search box automatically selected when I select a tab? At the very least, how can I get the default engine to be selected on page load?

alex
  • 479,566
  • 201
  • 878
  • 984
Teknophilia
  • 758
  • 10
  • 23
  • There is another question with the correct answer here: http://stackoverflow.com/questions/45827/how-do-you-automatically-set-the-focus-to-a-textbox-when-a-web-page-loads – Steve Mar 26 '11 at 00:28

2 Answers2

0

You can use javascript focus() for that. Execute the script when the tab is changed.

MacGucky
  • 2,494
  • 17
  • 17
0

On the click handler of your tab, do this....

document.getElementById('tabs-container').getElementsByTagName('li').onclick = function () {

   document.getElementById('search-input-' + this.id).focus();

}

Of course, change it to suit your HTML. Hopefully if you have a tie like that between them, you can write one event handler and not three.

alex
  • 479,566
  • 201
  • 878
  • 984