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.

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