can't focus form with script

Discussion in 'HTML' started by Joe Butler, Oct 16, 2007.

  1. Joe Butler

    Joe Butler Guest

    Any ideas why this form is not focusing on the text area control?
    Doesn't focus in FF1 or IE6 - nothing else tested, since it should work with
    these as google works (but with a different script).

    scripts are allowed to run in FF and IE.


    <a name="event16">
    </a>

    <form name="form16" class="event" style="width: 80%;"
    action="/cal/index.php" method="post">
    <a href="/cal/index.php?cancel=16">&nbsp;cancel&nbsp;</a>

    <input value="save" type="submit">
    <input name="idsave" value="16" type="hidden">
    <textarea name="edit" rows="5" cols="60">df df</textarea>
    </form>

    <script type="text/javascript">
    <!-- document.form16.edit.focus();
    // -->
    </script>
     
    Joe Butler, Oct 16, 2007
    #1
    1. Advertisements

  2. Joe Butler

    John L. Guest

    Joe Butler wrote:
    > Any ideas why this form is not focusing on the text area control?
    > Doesn't focus in FF1 or IE6 - nothing else tested, since it should work with
    > these as google works (but with a different script).
    >
    > scripts are allowed to run in FF and IE.
    >
    >
    > <a name="event16">
    > </a>
    >
    > <form name="form16" class="event" style="width: 80%;"
    > action="/cal/index.php" method="post">
    > <a href="/cal/index.php?cancel=16">&nbsp;cancel&nbsp;</a>
    >
    > <input value="save" type="submit">
    > <input name="idsave" value="16" type="hidden">
    > <textarea name="edit" rows="5" cols="60">df df</textarea>
    > </form>
    >
    > <script type="text/javascript">
    > <!--
    > // -->
    > </script>


    From http://www.w3.org/TR/html401/interact/scripts.html#h-18.3.2:

    Commenting scripts in JavaScript
    The JavaScript engine allows the string "<!--" to occur at the start of
    a SCRIPT element, and ignores further characters until the end of the line.

    So put your statement on a new line.
     
    John L., Oct 16, 2007
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-15?Q?Josef_Bl=F6sl?=
    Replies:
    1
    Views:
    26,801
  2. Talal Itani
    Replies:
    0
    Views:
    505
    Talal Itani
    Feb 24, 2007
  3. Jason
    Replies:
    4
    Views:
    1,967
    Jason
    May 7, 2007
  4. Rajat
    Replies:
    3
    Views:
    976
    Jorgen Grahn
    Jan 8, 2010
  5. Replies:
    2
    Views:
    534
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  6. Roger
    Replies:
    3
    Views:
    609
  7. Jeff

    manual focus vs. focus()

    Jeff, May 20, 2007, in forum: Javascript
    Replies:
    4
    Views:
    342
  8. Spizzat2
    Replies:
    2
    Views:
    381
    Spizzat2
    Jan 9, 2008
Loading...