#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Colombia
    Posts
    2
    Rep Power
    0

    Javascript and Textareas


    I have a page where I log everything that I do when I get into the office. But there is some stuff that I'm beginning to find that I write in on a daily basis. I was thinking that it would make my life easier if I would make a drop down menu with what I always write, so I can choose it, and then write the stuff that changes every day. So waht I want to do is something like what they have here, when you post. A drop down menu that, when I click on one of the options it adds it to the textarea. I kinda think about it as concatinating, or something of the sort. I have no idea about Javascript but a friend told me it would be perfect for the job. Any and all help is GREATLY aprecceated..

    Thanks, =)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Wilmslow, Cheshire
    Posts
    255
    Rep Power
    18
    Just adapt this. Should do the trick.

    <SCRIPT LANGUAGE="javascript">
    <!--
    function addTheUsualStuff() {
    document.forms.dailyLog.dailyEntry.value += document.forms.usualStuff.theUsualStuff.value
    }
    //-->
    </SCRIPT>


    <FORM ACTION="whatever" METHOD="POST" ID="dailyLog" NAME="dailyLog">

    <TEXTAREA COLS="80" ROWS="5" NAME="dailyEntry" ID="dailyEntry">Add daily log here</TEXTAREA>

    </FORM>

    <FORM ACTION="" METHOD="POST" ID="usualStuff" NAME="usualStuff">

    <SELECT NAME="theUsualStuff" ID="theUsualStuff">
    <OPTION VALUE="Got out of bed">Got out of bed</OPTION>
    <OPTION VALUE="Had some coffee">Had some coffee</OPTION>
    <OPTION VALUE="Wrote diary">Wrote diary</OPTION>
    </SELECT>

    <INPUT TYPE="BUTTON" VALUE="Add the usual stuff" onClick="addTheUsualStuff()">

    </FORM>
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Colombia
    Posts
    2
    Rep Power
    0

    Talking Thanks


    Thanks a lot for the help! The scrip is just waht I needed,

IMN logo majestic logo threadwatch logo seochat tools logo