How could I take text from one textbox and put it into another textbox? Can anyone tell me how to do this by pressing a button?
Thank you in advance.
===
The distant cousin of c++,
a++
How could I take text from one textbox and put it into another textbox? Can anyone tell me how to do this by pressing a button?
Thank you in advance.
===
The distant cousin of c++,
a++
Heh, whoa!! Taking text from one text box and putting it into another text box? Here is some code:
Code:<html> <head> <script type="text/javascript"> function add(t,u) { document.getElementById(u).value = document.getElementById(t).value; } </script> </head> <body> <input type="text" id="t1"><br /><input type="text" id="t2"><br /><input type="button" value="Add" onclick="add('t1','t2');"> </body> </html>
a++ (10-10-2008)
Oh, wow! Thanks for that quick reply! It works great!
Much thanks!
===
The distant cousin of c++,
a++
Here is some better code:magicyte, never forget your validation, and stay away from the pseudo-XHTML and presentational markup.Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Page Sans Titre</title> </head> <body> <form action="/server/side/equivalent" onsubmit="return (this.elements.text1.value = this.elements.text2.value), false;"> <div> <textarea name="text1">Foo</textarea> <textarea name="text2">Bar</textarea> <input type="submit" value="Copy"> </div> </form> </body> </html>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
a++ (10-10-2008)
Thanks for the code, Twey!!
===
The distant cousin of c++,
a++
Bookmarks