SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Forms and JavaScript

    How do I set the value of a certain part of a form using javascript?

    Thanks
    Jim
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  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)
    document.formname.elementname.value="bob"

    for example if I had

    Code:
    <form name="form1">
       <input type="text" name="bob">
    </form>
    You would change the value using the format above

    Code:
    document.form1.bob.value="this is the value"
    This doesn't work for checkboxes or radio buttons as those are contained a different way.???

    For a radio button this works well and a checkbox
    Code:
    document.form1.radioName.checked=true or false

    Hope that helps and doesn't confuse
    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.


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
  •