Skip to main content
March 15, 2007
Question

text area value change

  • March 15, 2007
  • 4 replies
  • 699 views
i have a text area with 5 text links underneath

the text area value is not set, but what i need is if i click text link 1, then i need to update the value of the textarea with a value of a column in my table called message1 where userid = session.user

how can i do this any ideas?
This topic has been closed for replies.

4 replies

Inspiring
March 19, 2007
Something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
bLockTextArea = false;
function setTextAreaValue(sValue, bHoldValue) {
document.myFormName.myTextArea.value = sValue;
if (bHoldValue) {
bLockTextArea = true;
}
}

function clearTextAreaValue() {
if (!bLockTextArea) {
document.myFormName.myTextArea.value = "";
}
}

</script>
</head>

<body>

<form name="myFormName">
<textarea name="myTextArea" rows="5" cols="50"></textarea>

<a href="JavaScript:setTextAreaValue('test123',true)" onMouseOver="setTextAreaValue('test123',false)" onMouseOut="clearTextAreaValue()">test</a>
</form>

</body>
</html>
Inspiring
March 16, 2007
In that case, just add the same code to the onMouseOver, and have it set the text area to blank on the onMouseOut:

<a href="##" onClick="document.myFormName.myTextArea.value = '#GetUser.MessageOne#'" onMouseOver="document.myFormName.myTextArea.value = '#GetUser.MessageOne#'" onMouseOut="document.myFormName.myTextArea.value = ''">#GetUser.Title1#</a>
March 17, 2007
ok yes thats what i have before but if you click to slect the value then move the mouse out, it emptys the content

what i need is

1. if a mouse hovers over show a preview
2. if a mouse moves off the hover over clear the content.
3. onclick needs to display the value but then the problem comes when the mouse is moved off it clears the content
if onclick i need the value to be held when the mouse is noved off.

hope you can understand this
Inspiring
March 15, 2007
How about:

<a href="##" onClick="document.myFormName.myTextArea.value = '#GetUser.MessageOne#'">#GetUser.Title1#</a>

Remember to change myFormName and myTextArea to their respective form and textarea element names.
March 15, 2007
ok yes that would work but i also want to mouse over so it shows a preview
Inspiring
March 15, 2007
Do these links bring the user to bookmarks or other pages?
March 15, 2007
ok i nearly have it working with the code below, but all i need to do now is when a single click it holds the value in the text area

1. on mouse over = change text of text area to alt

2. on mouse out clear the text area.

3. on click display and hold the value of alt

i have this code but it will not hold the value on click, because the the mouse out, how could i change this

<a href="##" alt="#GetUser.MessageOne#" alt2="" onMouseOver="changeText(this.alt)" onMouseOut="changeText(this.alt2)" onClick="changeText(this.alt)">#GetUser.Title1#</a>