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 5 of 5

Thread: access 'form'

  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    108
    Thanks
    22
    Thanked 2 Times in 2 Posts

    access 'form'

    it is said that the 'form' node can be accessed by document.forms.certainName but it fails on my browser(IE8)
    however for images, it works, that is, document.images.certainName returns a Node.

    is there bugs only on 'form' tag? btw, document.forms[0] works ...

    quite quirky...

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,394
    Thanks
    13
    Thanked 353 Times in 349 Posts
    you could also try document.formname.elementname
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Posts
    108
    Thanks
    22
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Dormilich View Post
    you could also try document.formname.elementname
    it doesn't work

    e.g.
    Code:
    <form name="theform"><input name="haha">aaa</input></form>
    then document.theform.haha throws an exception
    (document.forms["theform"] doesn't work,either)

  • #4
    Regular Coder
    Join Date
    Dec 2009
    Posts
    108
    Thanks
    22
    Thanked 2 Times in 2 Posts
    oh i run it before the page is loaded ...

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    Can't refer to anything in a <form> until the form is closed with the matching </form> tag.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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