DEMO of onkeypress event

What ever you type here
(Type minimum two chars)

will be copied to below textarea.

JavaScript

<script type='text/javascript'>
var t1 = document.getElementById('t1'); 
t1.onkeypress=function(){my_code()};

function my_code(){
var text_val = document.getElementById('t1').value; 
document.getElementById('t2').innerHTML=text_val; 
}
</script>

HTML

<input  type=text id=t1 name=text> <br>
(Type minimum two chars)<br><br> will be copied to below textarea. <br>
<textarea id=t2   name=my_text rows=4 cols=30></textarea>

getElementById



plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer