SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript and forms

    how do I grab form values using javascript?

    is it different for each type of form element?
    Free Science Homework Help
    http://www.physicsforums.com

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope. Pretty simple really.

    document.formname.elementname.value

    This works for hidden, text and textareas

    To find out if something is checked

    document.formname.elementname.checked (if it is true it is check and if it is falses it isn't checked)

    You can also pass the variables into a function needing less typing. Take this example

    <input type="text" name="ele1" id="ele1" onchange="validate('string',this.value) />

    This will pass the value directly meaning you don't need to reference it at all. Just check it in your function (if you create said function )
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool! thanks
    Free Science Homework Help
    http://www.physicsforums.com


Bookmarks

Posting Permissions

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