Results 1 to 2 of 2

Thread: Difference between getElementById and getElementByTag

  1. #1
    Join Date
    Jul 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Difference between getElementById and getElementByTag

    Please any one can tell me what is difference between getElementById and getElementByTag.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    One, getElementById() is a valid javascript object method, the other is not (although a function could be written to create it as one if you wanted to). But, perhaps you mean getElementsByTagName() - that is also a valid javascript object method. The difference is that ElementById will retrieve a single element object with the unique id specified, whereas ElementsByTagName will retrieve an array of all element objects with the specified tag name.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •