Results 1 to 5 of 5

Thread: need a javascript expert

  1. #1
    Join Date
    Nov 2002

    Unhappy need a javascript expert

    I need a javascript that will help me add a line of text into a textarea field in a form via a checkbox

    THE LINE '\image{my photo}' is added to the <textarea>\image{my photo}</textarea> field

    I hope I explained this right .

  2. #2
    Join Date
    Nov 2002
    Columbia, MD

    Lightbulb not sure if this is exactly what you're looking for...

    but this is what it sounds like you want to do to me. What I would do is create a function to add the line of text to the textarea first. Then, when you create your checkbox, call the function you created from the checkbox's ONCLICK event:

    <SCRIPT LANGUAGE = "JavaScript" TYPE = "text/javascript">
      function AddText()
        var objForm = document.frmTest;
        objForm.txtTextArea.Value = "Whatever you want it to say";
    <INPUT TYPE = CHECKBOX NAME = chkTest VALUE = "Y" ONCLICK = "AddText()">
    Hope this helps. Good luck!

  3. #3
    Join Date
    Nov 2002
    nevermind Its not going to work on my forum script because the textarea already has a set name="message" value and cannot be removed or the board will break... thanks anyways.
    Or is it possible to still get it to work even if the textarea field already has a set name="message" value?
    Last edited by mikel; 11-25-2002 at 11:05 PM.

  4. #4
    Join Date
    Nov 2002

    <input type="checkbox" onClick="form.textArea.value='\image{my photo}';">&nbsp;&nbsp;<input type="checkbox" onClick="form.textArea.value='';">

    <textarea name="textArea" cols="65" rows="10"></textarea>


    That should do what you want it to. Hope this helps!

  5. #5
    Join Date
    Nov 2002
    ok I finally got it to work by adding the following line of code to the board software from the last poster

    <input type="checkbox" onClick="form.message.value='\\image{my photo}';">

    I changed the onclick from "textarea" to "message"
    to make my script happy so it wouldnt break the board script
    also because of the strange code of the forum software I had to add an extra \ in the onclick="form.message.value='\image{my photo}';"> code as you can see above.

    Thanx Zach Elfers I will put a credit up to you for helping me
    at the board if you give me the ok.

    my forum board http://cgi-help.sytes.net
    Last edited by mikel; 11-25-2002 at 11:25 PM.

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