D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] inputbox focus

 

kevin wrote:
On Fri, 2010-01-29 at 12:22 +0000, Martijn Grooten wrote:
On Fri, Jan 29, 2010 at 12:06 PM, kevin wrote:
Can I ask if any one knows a "Simple" way of getting an anchor in html
to go to an input box?
ie: (or ff) I would like to have a link on a page which puts the cursor
in an input box called "plu" I can get the page to move to the same line
as the box but not the cursor inside the box
I'm pretty sure think it can't be done in plain HTML. But the
JavaScript is really simple:

<a href="#anchor" onclick="document.getElementById('textbox').focus()">click</a>

and then make sure to add id="textbox" to your textbox declaration.

Martijn.
Thanks Martin
This is probbably the simplist method as you say (I was resorting to a
function in javascript). BTW is id and name the same thing and /or can
they have the same name? ie (or ff) can I have the tag name=plu and
id=plu?
You can have name='wibbly' id='wibbly'
its best to keep them the same mind!
check out w3c for details...
Tom te tom te tom

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html