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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthew

    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?
  • Randy Webb

    #2
    Re: Need help with onclick event to cause cursor movement into formbox

    Matthew wrote:
    [color=blue]
    > 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?[/color]

    <a href="whyThisWo ntWorkWithoutJS .html"
    onclick="docume nt.forms['formName'].elements['elementName'].focus();
    return false">
    <img src="myImage.pn g" alt="Click My Image" /></a>

    With:

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

    Should give you a starting point.

    --
    Randy
    Chance Favors The Prepared Mind

    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: Need help with onclick event to cause cursor movement into formbox

      Randy Webb <hikksnotathome @aol.com> writes:
      [color=blue]
      > <a href="whyThisWo ntWorkWithoutJS .html"[/color]

      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="#elementI d"
      where you give the element id="elementId" .
      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...