My Custom Rack I Built
Reply to topic
 
textarea to textarea using the getelementbyid method



Joined:05 Mar 2005
Posts:2
Reply with quote
Need help tweaking this script to use textarea input instead of a dropbox.
Please and thanks to all replys

<html>
<head> <SCRIPT LANGUAGE="JScript">
val='';
function fnAdd(obj){
if (obj.selectedIndex<0||val.match(obj.options[obj.selectedIndex].value)){ return; }
val+=obj.options[obj.selectedIndex].value+'\n';
document.getElementById('fred').value=val;
}
</SCRIPT>

<title></title>
</head>

<body>


<SELECT ID=someText>
<OPTION VALUE="">some text</OPTION>
<OPTION VALUE="some text1">some text1</OPTION>
<OPTION VALUE="some text2">some text2</OPTION>
<OPTION VALUE="some text3">some text3</OPTION>

</SELECT>
<INPUT TYPE=button VALUE="Add To Textarea" onclick="fnAdd(document.getElementById('someText'));">

<textarea id="fred" rows="10" cols="20"></textarea>

</body>

</html>
View user's profileFind all posts by lgkSend private message
textarea to textarea using the getelementbyid method

Moderator

Moderator

Joined:25 Jan 2003
Posts:1312
Location:England
Reply with quote
Code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function fnAdd(obj,x)
{
 if (obj.value!="")
 {
  if(x==1){document.getElementById('second_ta').value=obj.value+'\n';}
  else{document.getElementById('second_ta').value=document.getElementById('second_ta').value + obj.value+'\n';}
 }
}
</SCRIPT>
 
</head>
<body>

<textarea id="first_ta" rows="10" cols="20"></textarea>
<INPUT TYPE=button VALUE="Send To Textarea" onclick="fnAdd(document.getElementById('first_ta'),1);">
<INPUT TYPE=button VALUE="Add To Textarea" onclick="fnAdd(document.getElementById('first_ta'),2);">
<textarea id="second_ta" rows="10" cols="20"></textarea>

</body>
</html>
View user's profileFind all posts by batfinkSend private message
textarea to textarea using the getelementbyid method
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 6 Hours  
Page 1 of 1  


  
  
 Reply to topic