/    Sign up×
Community /Pin to ProfileBookmark

Inserting javascript variables into textarea from a form

Hello peoples.
Right, here’s what I’m trying to do; the player fills in 2 forms, then those entries are to be saved as javascript variables and printed into a textarea, along with some other text. This will go onto creating a link in HTML.

I want these variables:

[CODE]var address= document.getElementById(‘address’);
var webname= document.getElementById(‘webname’);[/CODE]

To be inserted into a text area, Here’s my full function:

[CODE]function insertaddress(){
var address= document.getElementById(‘address’)
var webname= document.getElementById(‘webname’)
insert (window.lstText,'<a href=’)
insert (window.1stText, var address)
insert (window.1stText, ‘>’)
insert (window.1stText. var webname)
insert (window.1stText. ‘</a>’)
document.getElementById(“webaddressenter”).style.display=”none”;
}[/CODE]

And here’s my form:

[CODE]<form id=”webaddressenter” style=”display:none;”>
<label for=”address”>Your URL:</label>
<input type=”text” name=”address” value=”” placeholder=”http:www.google.com” id=”address”/><br />
<label for=”webname”>Website name:</label>
<input type=”text” name=”webname” value=”” placeholder=”Google” id=”webname”/><br />
<input type=”button” value=”submit” onclick=”insertaddress()” id=”tag” />
</form>[/CODE]

Can you see what I need to do ?
– Thanks, Xanco.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Nicholas_DiazApr 06.2013 — Before the form

<body onload="insertaddress()">
×

Success!

Help @Xanco 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...