iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I love the code... dot com
    20,060

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Javascript Focus Form Field

    Javascript Focus Form Field



    <form name=aaa>
    This is GGG: <input type=text name=ggg><br>
    This is HHH: <input type=text name=hhh>
    </form>

    <script type="text/javascript">

    function dofo() {
    document.aaa.hhh.focus();
    }

    </script>

    <body onLoad=dofo()>


    -We create an HTML form and name it aaa because that is easy to type and remember.
    -We name our first text field ggg because we have a cat named G
    -We name our second text field hhh because we want to.
    -We write a little function and call it dofo because we think that is a clever name.
    -document.aaa.hhh.focus();
    ---document - is the object we are manipulating, this page.
    ---aaa - is our form name.
    ---hhh - is the element name we want to place the focus on.
    ---focus() is a built-in Javascript method that places focus, the cursor in this instance.
    -We call the function in our HTML body tag using onLoad.

    When the page with this script loads, the cursor will be in the second text field, hhh.


    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--

    function dofo() {
    document.aaa.hhh.focus();
    }

    -->
    </script>

    <body onLoad=dofo()>

    <form name=aaa>
    This is GGG: <input type=text name=ggg><br>
    This is HHH: <input type=text name=hhh>
    </form>



    Resources:
    HTML Forms
    Write a Function
    Call a Function
    HTML Body Tag

    Make Text Lowercase
    Make Text Uppercase
    Make Text Superscript Using Javascript
    Make Text Subscript Using Javascript
    Make Text Bold Using Javascript
    Italic Text in Javascript


    HTML Tags
    HTML Color Chart
    HTML Codes


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Javascript Lowercase Text
    Next Article: Opening a REMOTE WINDOW in Javascript





    JavaScriptJavaScript

    David Flanagan

    New $31.49

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $26.39

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $29.69

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.09

    CSSCSS

    Eric Meyer

    New $29.69

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $26.39

    CSSCSS

    David McFarland

    New $23.09


    Of Interest:
  • What Environmental Variables are Available
  • Create an Array of Specific Numbers in Perl
  • Combine, Put Two Arrays Together in Perl
  • Splitting an ARRAY in Perl
  • Close Window with window.close in Javascript
  • Javascript Slice - Use Slice to Get Items from an Array in Javascript
  • Javascript Join - Use Join to Make an Array into a String in Javascript
  • Use onMouseOut in Javascript
  • HTML Forms
  • HTML Link
  • HTML Background
  • HTML Body Tag

  • More Articles:
  • Create an Array of Specific Numbers in Perl
  • Matching at the Beginning and End 2
  • Matching with a Regular Expression, REGEX, in Perl
  • INCREMENT and DECREMENT a Variable in Perl
  • Javascript Change Background Colors
  • Javascript Change Fonts
  • onClick Javascript
  • Javascript Change Font Size
  • Splitting an Array using Javascript
  • Use onLoad to Call More than One Function with Javascript
  • Javascript Slice - Use Slice to Get Items from an Array in Javascript
  • Javascript Italics Text
  • HTML Space
  • HTML Forms
  • Make Italic Text Using HTML
  • HTML Frames

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    316,800
    Counter by iLoveTheCode.com


    Last Modified: Sunday, 09-Jul-2006 01:40:45 EDT