473,322 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Setting focus to search page input field

Hi

I have been the following code by Freefind to use on my search page:

<form action="http://search.freefind.com/find.html" method="get"
accept-charset="utf-8" target="_self">
<input type="hidden" name="id" value="[unique id for my website]">
<input type="hidden" name="pageid" value="r">
<input type="hidden" name="mode" value="all">
<input type="hidden" name="n" value="0">
<input type="hidden" name="_charset_" value="">
<input type="hidden" name="bcd" value="÷">
<input type="text" name="query" size="15">
<input type="submit" value=" Find "></form>

It works great, but want to set the focus to the search textbox when
the page loads so that the user can start typing, using <body onload
="document.getElementById('ScrollableContent').foc us()">, but I can't
see any id for the search textbox in the code I've been given.

How can I set the focus to the search textbox when the page loads?

Dave
Jun 27 '08 #1
5 2229
Sorry typo in my previous post, I meant to write:

It works great, but I want to set the focus to the search textbox when
the page loads so that the user can start typing straight away, using
<body onload="document.getElementById('[id of textbox]').focus()">

Dave
Jun 27 '08 #2
Dave Rado <da*******@dsl.pipex.comwrites:
Hi

I have been the following code by Freefind to use on my search page:

<form action="http://search.freefind.com/find.html" method="get"
accept-charset="utf-8" target="_self">
<input type="hidden" name="id" value="[unique id for my website]">
<input type="hidden" name="pageid" value="r">
<input type="hidden" name="mode" value="all">
<input type="hidden" name="n" value="0">
<input type="hidden" name="_charset_" value="">
<input type="hidden" name="bcd" value="÷">
<input type="text" name="query" size="15">
<input type="submit" value=" Find "></form>

It works great, but want to set the focus to the search textbox when
the page loads so that the user can start typing, using <body onload
="document.getElementById('ScrollableContent').foc us()">, but I can't
see any id for the search textbox in the code I've been given.
Just add one:

<input type="text" name="query" id="ScrollableContent" size="15">

Though you should probably use a more meaningful ID.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jun 27 '08 #3
I've worked out the answer - I just needed to change to form's code
from:

<input type="text" name="query" size="15">

to <input type="text" name="query" id="query" size="15">

.... and then use the id "query" in my onload statement.

Sorry about that.

Dave
Jun 27 '08 #4
On Apr 15, 12:22 am, Joost Diepenmaat <jo...@zeekat.nlwrote:
Though you should probably use a more meaningful ID.
Yes, that was a typo, sorry (see my earlier replies to my original
post, which I was typing while you were typing your reply).

Thanks, and apologies for posting before I'd put enough thought into
trying to solve it myself.

Dave
Jun 27 '08 #5
Dave Rado <da*******@dsl.pipex.comwrites:
On Apr 15, 12:22 am, Joost Diepenmaat <jo...@zeekat.nlwrote:
>Though you should probably use a more meaningful ID.

Yes, that was a typo, sorry (see my earlier replies to my original
post, which I was typing while you were typing your reply).

Thanks, and apologies for posting before I'd put enough thought into
trying to solve it myself.
No problem. Sometimes it just works best to step back a bit to think
things over.

Cheers,
Joost.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: fish | last post by:
Hi, I have an HTML page with a FORM and some input fields. On the fields I wish to do validation as the punters change the field values. If they get it wrong, then I tell them and then wish...
11
by: JCO | last post by:
I have a text box, on my form that I cant get the focus on. I'm using it as shown: <head> <body onload=document.getPassword.txtPasswordName.focus()> </head> Where getPassword is the form &...
2
by: dsnyder | last post by:
This HTML has a bit of Javascript at the end that puts the initial focus on the userID field. It works great on Windows2000 running IE6, but the initial focus never goes to the userID field on...
6
by: Csaba | last post by:
I'd like to have the cursor in the login form's username input text field when users load the login page. It works fine with the following implementation: <body...
7
by: ScooterMX | last post by:
I've seen where login pages (and other form-based pages) place the cursor in the first field of a form after the page loads. I'm familiar with the tabIndex, but that only works once you hit the...
3
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There...
5
by: jose1lm | last post by:
What is supposed to happen: A user enters data into one of the FORM input selections. When the user submits the form, the onclick event is supposed to go to a function that will set another FORM...
4
Claus Mygind
by: Claus Mygind | last post by:
I am creating an element dynamically as I load it on the screen. When it was hard coded on the page I had no problem executing the following two lines. document.getElementById("SEARCH").select();...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.