Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
i have a webpage which has a search box right at the top of the page.
How can i make it so that the cursor is in the search box at the begining when the page loads?
Adam
|
Ally
Member
Registered: 2nd Jul 03
Location: Pontypool Drives: a Skoda
User status: Offline
|
http://javascript.about.com/library/blmousepos.htm
|
James
Member
Registered: 1st Jun 02
Location: Surrey
User status: Offline
|
Is the page just in html? If so you can do it client side by setting the focus using javascript.
If your using something that needs be parsed on a server i.e PHP or ASP then it would be better to set the focus server side using that language
|
James
Member
Registered: 1st Jun 02
Location: Surrey
User status: Offline
|
Well saying that, both server side and client side have pros and cons but working for barclays we have to use server side as much as poss because we cant rely on client PCs
[Edited on 04-12-2005 by James]
|
MikeLamb
Member
Registered: 23rd Sep 03
Location: Crowthorne Drives: Veccy SRI
User status: Offline
|
How the hell can you set that serverside?????
Every page is HTML, whether its produced serverside or not doesnt make a difference!
put this in the head:
<script>
function bart(){document.myformname.searchfield.focus();}
</script>
add this to the <body> tag
onLoad=bart()
eg:
<body onLoad=bart()>
Obviously replace "myformname" with the name of the form and "searchfield" with the name of the field you want to focus on.
[Edited on 04-12-2005 by MikeLamb]
|