www.webdeveloper.com
Results 1 to 2 of 2

Thread: Inserting javascript variables into textarea from a form

  1. #1
    Join Date
    Apr 2013
    Posts
    1

    Question 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');
    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";
    }
    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>
    Can you see what I need to do ?
    - Thanks, Xanco.

  2. #2
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    Before the form
    <body onload="insertaddress()">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles