469,360 Members | 1,774 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Need help with onclick event to cause cursor movement into form box

Hi, how can I create a <A HREF'ed> image that, with an onclick event
will cause the cursor to jump into a particularly assigned text form
input field?
Jul 20 '05 #1
2 1462
Matthew wrote:
Hi, how can I create a <A HREF'ed> image that, with an onclick event
will cause the cursor to jump into a particularly assigned text form
input field?


<a href="whyThisWontWorkWithoutJS.html"
onclick="document.forms['formName'].elements['elementName'].focus();
return false">
<img src="myImage.png" alt="Click My Image" /></a>

With:

<form name="formName" action="">
<input type="text" name="elementName">
</form>

Should give you a starting point.

--
Randy
Chance Favors The Prepared Mind

Jul 20 '05 #2
Randy Webb <hi************@aol.com> writes:
<a href="whyThisWontWorkWithoutJS.html"


While I normally use this href as well for examples, this case
actually have a reasonable alternative URL-fragment that can be used:
<a href="#elementId"
where you give the element id="elementId".
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Anders Nielsen | last post: by
6 posts views Thread by Cockroach | last post: by
7 posts views Thread by fox | last post: by
2 posts views Thread by sorobor | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.