Author Topic: Simultaneous text in ajax or php  (Read 784 times)

onlineadsforsites

  • Guest
Simultaneous text in ajax or php
« on: June 08, 2010, 04:23:22 AM »
I would like to create php code in such a way that when we are entering in the text box another box simultaneously displays what i am entering like a screen.That is i do not have to click a button before seeing the result.
 
For example i am typing here now.As i type ,the text that i type should be simultaneously displayed in another box (not this box) as a simultaneous text.
Is there any code in php for that?

PHP Coder

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 130
  • Karma: +0/-0
    • View Profile
    • PHP coder
Re: Simultaneous text in ajax or php
« Reply #1 on: June 08, 2010, 11:38:29 AM »
This can be implemented in Javascript, even with no Ajax.

Here is example of such code:

Code: [Select]
<html>
<body>
<form>
Enter text here:<br>
<textarea cols="50" rows="5" onKeyPress="{document.getElementById('area2').value=this.value;}"></textarea>
<br>
<br>
you can see your text here too:<br>
<textarea id="area2" cols="50" rows="5"></textarea>
</form>
</body>
</html>

You can create file test.html, paste there the code above and try :)
PHP coder for hire

nimesha

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Simultaneous text in ajax or php
« Reply #2 on: October 20, 2010, 12:24:02 AM »
The above answer's event can be modified to "onKeyUp"
PHP Code: [Select]

<textarea cols="50" rows="5" onKeyUp="{document.getElementById('area2').value=this.value;}"></textarea>


Then the output can be seen while typing :)