/    Sign up×
Community /Pin to ProfileBookmark

textarea to textarea using the getelementbyid method

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

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Mar 13.2005 — With form elements you should use names with the form array, not id. It can be donw with the id.

document.formName.elementName1.value = document.formName.elementName2.value;

Eric
×

Success!

Help @lgk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...