#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    New JavaScript Programmer Need assistance with textboxes


    Please Help..
    I need to pass user inputted values from a textbox and append into a textarea using the onClick event. The user should also have the ability to remove the value they have already added.

    All appended values would then be submitted into a database.

    Can someone please tell me how to go about writing this script?
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Your professor or TA can help you get started on this.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    2
    Rep Power
    0

    1st issue resolved. I now need to know how to removes lines from a textarea with a bu


    I have the first part of my script working where I can append new lines to the textarea from a regular input box via button, but I need to be able to remove one or more lines of text from the textarea when selected with a second button.

    Can someone help me out with this? I'm sure I'm missing something really simple here.

    Here is my code:




    [CODE

    <!-- This function works //-->
    <script language="javascript" type="text/javascript">
    function addtext() {
    var newtext = document.myform.inputtext.value;
    document.myform.outputtext.value += newtext + "\n";
    }

    <!--This function doesn't work //->

    function removeText()
    {
    var oldtext=document.getElementById("outputtext");
    document.myform.outputtext.value.removeChild(textarea.childNodes[0]);

    }



    </script>



    <form name="myform">
    <table width="495" border="0" cellpadding="5" cellspacing="0"><tr>
    <td width="167" rowspan="2" valign="bottom"><input type=text name="inputtext"></td>

    <td width="133" height="63" valign="middle"></p>
    <input type="button" value="Add Category" onClick="addtext();"></td>
    <td width="165" rowspan="2"><textarea name="outputtext" rows="6"></textarea></td>
    </tr>
    <tr>
    <td valign="top"><input type="button" name="Reset" id="Reset" value="Reset Categories" onClick="removetext();"></td>
    </tr>[/CODE]

IMN logo majestic logo threadwatch logo seochat tools logo