iLTC Home
Bookmark iLTC!

Categories

Perl
  • Perl Tutorials Beginners

  • Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

  • HTML
  • HTML Tutorials

  • Command Line
  • Command Line Tutorials

  • How Tos
  • Other Tips and Tricks



  • for(var i;i < 1000;i++) { }
    1724596

    iLoveTheCode.com

    Change a Form Field with Javascript

    To change a form field with Javascript:

    function sayHey() {
    fo.el.value="Fill it in, dog!";
    }

    <FORM name=fo>
    <input type=text name=el>
    </FORM>

    <a href="#" onMouseOver="sayHey()">Mouse Over Me, Please</a>


    First, I'll explain our FORM:
    -We named our form fo because we like short names.
    -We named our text field el because we like easy to type names.

    Next, I'll explain our function:
    -We created a function and named it sayHey().
    ---the first section needs the form name which we named fo
    ---the second section needs the form element name which we named el
    ---the third section is the word value which means we are about to say what we want fo.el to equal.

    Lastly:
    -We created a link and used Javascript's onMouseOver event handler to call our function.


    When we onMouseOver the link, the text field will fill with our text "Fill it in, dog!".


    Free Copy and Paste Javascript Code:

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

    function sayHey() {
    fo.el.value="Fill it in, dog!";
    }

    -->
    </script>


    <form name=fo>
    <input type=text name=el>
    </form>

    <a href="#" onMouseOver="sayHey()">Mouse Over Me, Please</a>


    Resources:
    Use OnMouseOver in Javascript
    Create a Function in Javascript
    Call your Function in Javascript




    Previous Article: Use onMouseOut in Javascript
    Next Article: Use onLoad in Body Tag with Javascript






    Search iLTC w/ Google




    Recent Articles

  • HTML Font Code
  • Javascript and CSS - Easy Pop Up Help Balloons
  • Use OnMouseOver in Javascript
  • Use onMouseOut in Javascript
  • Use innerHTML to Change Text on a Page
  • Renaming a File with Perl's RENAME Function
  • PRINT to Browser with document.write Command in Javascript
  • Passing an Argument or Variable to a Javascript
  • Opening an Alert Box in Javascript
  • Opening a REMOTE WINDOW in Javascript
  • OPEN and WRITE a Data File in Perl
  • OPEN and READ a Data File in Perl
  • Mimic Typing from a Textfield in a Textarea with Javascript
  • Javascript Reset Form








  • Perl Programming - Javascript Programming - HTML Code - Mac Unix Command Line - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006-2009 iLoveTheCode.com


    Contact Chris | About this Site


    1724321
    Counter by iLoveTheCode.com


    Last Modified: Friday, 06-Feb-2009 03:15:09 EST



    Hosted as well :)
    Home-brewed logo - 1997