Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Click on link to generate text in a textarea?
- From: javascript@xxxxxxxxxx (David Yee)
- Subject: [Javascript] Click on link to generate text in a textarea?
- Date: Tue, 18 Dec 2001 12:22:11 -0800
Terrific- thanks a lot Peter! David > -----Original Message----- > From: Peter Brunone [mailto:peter@xxxxxxxxxxx] > Sent: Tuesday, December 18, 2001 12:33 PM > To: javascript@xxxxxxxxxx > Subject: Re: [Javascript] Click on link to generate text in a > textarea? > > > <FORM NAME="mainForm"> > > ... > > <A HREF="javascript:writeText('text1','Extra text')">Click this</A> > <TEXTAREA NAME="text1">Here's some text</TEXTAREA> > > ... > > </FORM> > > <SCRIPT LANGUAGE="JavaScript"> > function writeText(boxName, newText) { > // Build the reference to the text box > var myBox = eval("document.mainForm." + boxName); > // Concatenate the new text to the end of the current text > // (The /n is a carriage return) > myBox.value = myBox.value + "\n" + newText; > } > </SCRIPT> > > Cheers, > > Peter > > ----- Original Message ----- > From: "David Yee" <dyee@xxxxxxxxxxxxxxx> > To: <javascript@xxxxxxxxxx> > Sent: Tuesday, December 18, 2001 2:09 PM > Subject: [Javascript] Click on link to generate text in a textarea? > > > | Hi all. Is it possible to write javascript that'll automatically > | type in text in a <textarea> when you click on the link? > E.g. I have > | a link called COMPANY_NAME, and when I click on the link I want the > | text "My Company" to be typed in immediately into the > <textarea> box > | next to that link at the cursor (thus not destroying what's already > | in the text box). Thanks for any help! > | > | David > | _______________________________________________ > | Javascript mailing list > | Javascript@xxxxxxxxxx > | https://lists.LaTech.edu/mailman/listinfo/javascript > | > > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > https://lists.LaTech.edu/mailman/listinfo/javascript >
- Prev by Date: [Javascript] Click on link to generate text in a textarea?
- Next by Date: [Javascript] Click on link to generate text in a textarea?
- Previous by thread: [Javascript] Click on link to generate text in a textarea?
- Next by thread: [Javascript] Click on link to generate text in a textarea?
- Index(es):