Display simultaneous text

Discussion in 'PHP' started by onlineadsforsites, Jun 8, 2010.

  1. #1
    I would like to get the code where

    " when you are typing in a text box ,another display box automatically displays the text that is being typed simultaneously".

    Eg :- If i am typing America -As i type "A" in the 'text box' the 'display box' should display "A".Then as i type m after A ,the display box will show " Am" (original word and second word).Now as i type e after Am in the text box the display box should show "Ame".

    I hope i am making it clear.

    How do we do that.
    Please suggest.
     
    onlineadsforsites, Jun 8, 2010 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    This is done via javascript not php

    
    <script type="text/javascript">
    
    function copyText() {
        document.getElementById('displayarea').innerHTML = document.getElementById('text').value;
    }
    
    </script>
    
    <textarea id="text" style="width: 300px; height: 100px" onKeyUp="copyText();"></textarea>
    <div id="displayarea" style="width: 300px; height: 100px; border: 1px solid #000;"></div>
    
    Code (markup):
     
    stephan2307, Jun 8, 2010 IP
  3. onlineadsforsites

    onlineadsforsites Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much Mr.Stephan.That works!:)
     
    onlineadsforsites, Jun 8, 2010 IP