38 users online (0 members and 38 guests)  


  Results 1 to 2 of 2

Related

  1. Input and Output computation    Forum: Javascript Forum
    Replies: 0
  2. Replies: 6
  3. Replies: 1
  4. html form data output    Forum: HTML Forum
    Replies: 1
  5. trying to write to textarea based on user input    Forum: Javascript Forum
    Replies: 5
  1. #1
    hackers0ns's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2008
    Posts
    1

    form input changes textarea output

    Hi,

    I'm creating an affiliate banner page where the user puts in the affiliate ID into one field which changes the code in a hidden field, then when they select a banner image it puts the code they need to copy into a textarea based on banner choice and affiliate ID.

    something like this... sunshine.co.uk/affiliates/Banners.html

    any help??

    Thanks, L

  2. #2
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: form input changes textarea output

    It will look something like this:

    Code:
    <script type="text/javascript">
    function updateID() {
         document.getElementById("newID").value = document.getElementById("affiliateID").value;
    }
    function updateCode(bImage) {
         var bannerCode = "HTML CODE" + bImage + "MORE HTML CODE" + document.getElementById("newID").value;
    
         document.getElementById("bannercode").value 
    }
    </script>
    
    <input type="text" id="affiliateID" onkeyup="updateID();" />
    <input type="hidden" id="newID" />
    
    <option name="bannerimg" onclick="updateCode("1");">One</option>
    <option name="bannerimg" onclick="updateCode("2");">Two</option>
    <option name="bannerimg" onclick="updateCode("3");">Three</option>
    
    <textarea id="bannercode"></textarea>



Tags for this Thread