• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

text area value change

Guest
Mar 14, 2007 Mar 14, 2007

Copy link to clipboard

Copied

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?
TOPICS
Advanced techniques

Views

602

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

Do these links bring the user to bookmarks or other pages?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 15, 2007 Mar 15, 2007

Copy link to clipboard

Copied

ok yes that would work but i also want to mouse over so it shows a preview

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2007 Mar 16, 2007

Copy link to clipboard

Copied

craiglaw98 wrote:
> 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
>

yes, the onmouseout event will fire every time after you move the mouse
away from the links, even after you have clicked on it. you could write
a js function that will set some var to true if a link has been clicked
on, then another function for the onmouseout event that will execute
only if the var is still false (a link has not been clicked on). the
other links you have should call same function, just provide different
values to put into the textarea. the onmouseover event of your links
should change the value of textarea to temp value and then revert it
back to previous value, not an empty string (otherwise if you have
clicked on one link, but then move your mouse over another link, the
previously clicked on value willl be deleted.

--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 19, 2007 Mar 19, 2007

Copy link to clipboard

Copied

LATEST
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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation