Jump to content


Inserting javascript variables into textarea from a form

  • Please log in to reply
No replies to this topic

#1 Xanco

  • Members
  • PipPip
  • Member
  • 11 posts

Posted 06 April 2013 - 01:00 PM

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:


var address= document.getElementById('address');
var webname= document.getElementById('webname');

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


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>')

And here's my form:


<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" />

Can you see what I need to do ?

 - Thanks, Xanco.

I'm a newbie, so be prepared for lots of questions...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users