PDA

View Full Version : Simple...changing value of a textarea when you click a link.


bacterozoid
10-13-2002, 04:43 PM
I've done this before, just haven't 'programmed' in a while (what simple stuff I do) so I forget...

What I want to have is a blank textbox, simple, got that. Then there will be two links on the page. Alright, got that. Well, when you click on a link, I want the value of the textbox to change into what I specify.


<form>
<p align="center"><textarea readonly name="text" rows="5" cols="59" style="font-family: arial">This is a test.</textarea></p>
</form>
<p align="center"><font color="#FFFFFF"><a href="http://" onClick="value.text='hi'">Click Me!</a></font></p>


that is what I came up with on my own, heh. Not even close to right, I know, but I can say I tried.

ACJavascript
10-13-2002, 06:09 PM
You can do this :D

_________
<script language="javascript">

function changeText(text){

document.change.textName.value=text
}

</script>

<form name="change">

<textarea name="textName" rows=6 cols=50 warp="virtual">
</textarea>

</form>
<a href="javascript:void(1);" onclick="changeText('WELCOME')">Click1</a>
<BR>
<a href="javascript:void(1);" onclick="changeText('WELCOME 2')">Click1</a>

_________

Hope this helps :D