Click to See Complete Forum and Search --> : Javascript Forms


Derebane
10-19-2003, 11:16 AM
How do you write a script that adds text in a textfield just by clicking on a button or submittng the form?

Khalid Ali
10-19-2003, 12:01 PM
document.formName.textFieldName.value='someText';

as the above line in any event(onclick??)

Derebane
10-19-2003, 06:12 PM
onClick and onSubmit yes. But what if I want to keep text in the textarea that has been entered manually and let the new text append to it?

fredmv
10-19-2003, 06:17 PM
Originally posted by Derebane
onClick and onSubmit yes. But what if I want to keep text in the textarea that has been entered manually and let the new text append to it? Basically the same idea. However, a slightly different operator is used:document.formName.elementName.value += "string";I hope that helps you out.

Derebane
10-19-2003, 06:28 PM
Oh, I solved it now. A matter of writing += instead och =