Click to See Complete Forum and Search --> : Using a textarea to output a text
ndcone
04-17-2006, 03:58 PM
I want to output a text into a textarea when an anchor is clicked. In other words when you click on an anchor a text is being displayed in the textarea.
Can some explain me how to do this?
jalarie
04-18-2006, 09:05 AM
<a href="#" onclick="document.forms['formname']['textareaname'].value='valuetodisplay'>label</a>
<Eddie>
04-18-2006, 10:41 AM
The A tag is used as an anchor or hyperlink. The best object for this task would be a button. <a href="#" is semantically incorrect.
jalarie
04-18-2006, 11:20 AM
<button value="label" onclick="document.forms['formname']['textareaname'].value='valuetodisplay'>
ndcone
04-19-2006, 02:13 PM
And btw is it possible to use something like a .txt file as a source for a text area so i only have to update the txt file instead of the whole page
jalarie
04-19-2006, 02:23 PM
And btw is it possible to use something like a .txt file as a source for a text area so i only have to update the txt file instead of the whole page
1. You could use a server-side routine, if such things are available to you and you know how to use them, to put a text file into a page. This would work for everyone and would probably be the best solution if possible.
2. You could use a frameset or iframe to display the text file as-is. You lose all HTML characteristics, and some users surf with frames turned off.
3. You could put the information into a Javascript (.js) file and generate that part of the page on the client. About 10% of users surf with scripting turned off.