Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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



This post first appeared on Beginnercode.com, please read the originial post: here

Share the post

Javascript: Focus() on a textbox

×

Subscribe to Beginnercode.com

Get updates delivered right to your inbox!

Thank you for your subscription

×