Home > General Site Maint > Javascript: Focus() on a textbox

Javascript: Focus() on a textbox

A dirty way to run js script inline and bring focus to an element:

<html>
<body>

    <form method="post" action="index.php" id="myForm">
        <p> Login: <input type="text" name="pwd" id="pwd" />  </p>
    </form>

    <script type="text/javascript">document.myForm.pwd.focus();</script>

</body>
</html>

Notice that both the form and form element have an ID

Categories: General Site Maint Tags:
  1. triplehhh93
    March 6th, 2010 at 05:50 | #1

    In the early morning hours of March 6, the Mexican Army advanced on the Alamo. After repulsing two attacks, Texians were unable to fend off a third. As Mexican soldiers scaled the walls, most of the Texian soldiers withdrew into interior buildings. Defenders unable to reach these points were slain by the Mexican cavalry as they attempted to escape. Between five microsoft exam 70-536 and seven Texians may have surrendered; if so, they were quickly executed. Most eyewitness accounts reported between 182 and 257 Texians dead, while most historians of the Alamo agree that 400–600 Mexicans were killed or wounded. Several noncombatants were sent to Gonzales to spread word of the Texian defeat. The news sparked a panic and the Texian army, most settlers and the new Republic of Texas government fled from the advancing Mexican Army.

  2. November 2nd, 2011 at 23:24 | #2

    So lovely.Wish you happiness.g

  3. March 7th, 2012 at 06:40 | #3

    Awesome post! It contains very useful information.Thanks for sharing knowledge.

  4. March 12th, 2012 at 22:16 | #4

    I like this post!christian louboutin outlet

  5. March 19th, 2012 at 04:04 | #5

    This Coach Factory O so cool. I am such a huge fan of their work. I really am impressed with how much you have worked to make this website so enjoyable.

  6. March 26th, 2012 at 02:33 | #6

    Deceptive only temporary, and integrity is a long-term strategy. When credit disappeared when the body, there is no life. If you want others to integrity, to our own integrity

  7. April 20th, 2012 at 08:05 | #7

    I am happy to find this post very useful for me, as it contains lot of information which i was searching for..Thank you..

  8. April 26th, 2012 at 23:07 | #8

    I am about to begin a blog and this will help me tremendously. Of course it has given me many things to consider as I update my website too. I appreciate it much.

  9. April 26th, 2012 at 23:08 | #9

    That Post is Full of informative. Thanks for that kind of sharing. Hope u will again share with us.

  10. April 26th, 2012 at 23:08 | #10

    Your blog is a great one. What really impresses me is that you are correctly mentioned that there are thousands of tools that are available to create a website or launch one but what matters is that you choose the right one, the one that gives you all that is actually needed

  11. April 28th, 2012 at 01:52 | #11

    “And so it has been, and so it is written
    On the doorway to paradise
    That those who falter and those who fall
    Must pay the price”

  1. March 31st, 2010 at 21:49 | #1