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



  • Perl with cheese...
    123,769

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Mimic Typing from a Textfield in a Textarea with Javascript

    Mimic Typing from a Textfield in a Textarea with Javascript



    To mimic typing from a textfield in a textarea using Javascript:

    <form name=fo>

    <input type=text name=fi onKeyUp="javascript:fo.se.value=fo.fi.value">

    <textarea name=se></textarea>

    </form>


    -We create a form and name it fo because we like short form names.
    -We name our text field fi because we are lazy typers.
    -We name our textarea se because we can.
    -In our textfield fi, we use Javascript's built-in onKeyUp method to work the magic...
    ---We type javascript: to let the browser know we are sending some javascript.
    ---We say fo.se.value=fo.fi.value which simply means: make the value of our textarea the same as the textfield.

    fo.se value
    fo.fi.value
    ---the first section needs the form name which we named fo
    ---the second section needs the form element name which we named se (textarea) and fi (textfield)
    ---the third section is the word value which means we are about to say what we want fo.se equal to. In this instance, we want it to equal fo.fi

    fo.se.value=fo.fi.value


    We could have also made the same thing happen by calling a function of our own making:

    function cHappy() {
    fo.se.value=fo.fi.value;
    }

    <form name=fo>
    <input type=text name=fi onKeyUp="javascript:cHappy()">
    <textarea name=se></textarea>
    </form>


    -We just created and named a function cHappy.
    -Put our mimicking code in that function - fo.se.value=fo.fi.value
    -Then called our cHappy function from the onKeyUp tag.



    Free Copy and Paste Javascript Code:

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

    function cHappy() {
    fo2.se2.value=fo2.fi2.value;
    }
    -->
    </script>

    <form name=fo2>
    <input type=text name=fi2 onKeyUp="javascript:cHappy()">
    <textarea name=se2></textarea>
    </form>

    <br><br>

    <form name=fo>
    <input type=text name=fi onKeyUp="javascript:fo.se.value=fo.fi.value">
    <textarea name=se></textarea>
    </form>



    Resources:
    Change a Form Field with Javascript
    Create a Function in Javascript
    Call your Function in Javascript



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Get String Length with Javascript
    Next Article: Close Window with window.close in Javascript





    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85

    HTMLHTML

    Gary B. Shelly, Th...

    New $84.55

    CSSCSS

    David McFarland

    New $23.09

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

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

    Eric Freeman, Elis...

    New $23.99

    CSSCSS

    Eric Meyer

    New $29.69

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39


    Of Interest:
  • Undefine an Array in Perl
  • Add, Subtract, Multiply, and Divide in Perl
  • Opening and Reading a Directory in Perl
  • To See if a Directory Exists in Perl
  • Use onClick in Javascript
  • Get Query String Using Javascript
  • Splitting an Array using Javascript
  • Getting Epoch Time in Javascript
  • HTML Image
  • HTML Underline Text
  • HTML Font Code
  • HTML Subscript Text

  • More Articles:
  • Exit a Loop with Last
  • Combine, Put Two Arrays Together in Perl
  • What Environmental Variables are Available
  • Undefine an Array in Perl
  • onClick Javascript
  • Getting Epoch Time in Javascript
  • Use innerHTML to Change Text on a Page
  • Select All or Highlight Text Fields and Textareas Using Javascript
  • Environmental Variables Available in Javascript using Navigator Object
  • Make Strikethrough Text Using HTML
  • HTML Space
  • HTML Codes
  • HTML Underline Text

  • 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


    420,530
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:16 EDT