<ry*********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Hi,
I have three textareas and four buttons within a form. The buttons has
often used text as value. When I press a button I whant the assigned
text to be added in whatever textareas im currently in (the one with
cursor blinking). Is this possible with Javascript?
--
Tommy Myrvoll
Will this help?
<html>
<head>
<title>often.htm</title>
<script type="text/javascript">
var what;
function fokus(that) {
what = that;
}
function often(that) {
if (what == null) return;
what.value = that.value;
}
</script>
</head>
<body>
<form>
<input type="reset" value="Reset">
<br><textarea name="a1" id="a1" cols="40" rows="3"
onfocus="fokus(this)"></textarea>
<br><textarea name="a2" id="a2" cols="40" rows="3"
onfocus="fokus(this)"></textarea>
<br><textarea name="a3" id="a3" cols="40" rows="3"
onfocus="fokus(this)"></textarea>
<br><input type="button" value="often used text 1"
onclick="often(this)">
<br><input type="button" value="often used text 2"
onclick="often(this)">
<br><input type="button" value="often used text 3"
onclick="often(this)">
<br><input type="button" value="often used text 4"
onclick="often(this)">
</form>
</body>
</html>