Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can anyone figure out what's wrong with this code?

    Hi

    I'm trying to use a js function to send an alert method when the user clicks on the command button on a form. For some reason I can't get the code to work (no alert method is triggered). Can anyone see anything obvious? :

    Code:
    }
     function setTextArea(form){
      alert(form.myarea.value);
    }
    
    
    <b>This section of the form uses a text area.</b><p>
    <form name="myform">
    <textarea name="myarea" cols="40" rows="5">
    Write your comments here.
    </textarea>
    <p>
    <input type="button" name="button3" value="Test TextArea" onClick="See TextArea(this.form)"><br>
    <p><p>
    </form>
    netwarriorgizmo

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    It appears u're never even calling the function.

    Your onClick should say:

    onClick="setTextArea(this.form)"

    Oh btw this shouldn't have been posted here, you should have posted it within here, which is the main JavaScript Programming forum.

    I think that should solve ur prob.
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."


  •  

    Posting Permissions

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