PDA

View Full Version : question about javascript



james_byrne
07-14-2008, 04:48 AM
i would like to create some buttons with javascript that once you click them they will add text to a textbox. i will try to do a example below.

|----------|
| button |
|----------|

ok click this button will add text to a text box, but it will not delete what i have currently typed.

If anyone has any good tutorials i can read to make this work, or any ideas for me i would really appreciate it.

Thanks in advance for the help.

jscheuer1
07-14-2008, 06:19 AM
If I understand you correctly, and you want to add text to the value of the text box, then in about the simplest of terms:


<form action="#">
<input type="button" value="Do It" onclick="this.form.elements['bob'].value += ' Mary';">
<input type="text" name="bob" value="Bob">
</form>

james_byrne
07-15-2008, 04:53 AM
Tanks very much, that is so easy. I love javascript.

Once again thanks so much.