SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.getElementByID not a function?

    Hi,

    I've got the following code on one of my pages, it works fine in IE6 and Netscape 6.2, but when you get around to using it on Netscape Navigator 4.08 it doesn't work, instead giving me a "document.getElementByID is not a function" error. Here's the code it has a problem with...

    function CrseDets(IDS) {
    window.open('coursedetails.asp?whereby=' + document.getElementById(IDS).value,null,'top=0,left=0,width=672,height=500, background="gfx/backgrd.gif", scrollbars=yes');

    }

    The page that this occurs on is http://www.moreton.tafe.net/courses.asp if anyone is interested in checking it out.

    Thanks,

    Daniel

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, NN doesn't recognize getElementById or
    getPrettyMuchAnything As a valid method.

    sorry

    You want to do set de to either document.getElementById OR document.all depending on your browser, i suppose.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For Netscape 4+ you'll need to use document.layers. This is Netscape's (pre N6) DOM.

    Check out this site for more info -
    http://www.xs4all.nl/~ppk/js/index.html?layerwrite.html

    Michele

  4. #4
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adog has some nice cross browser DOM code here:

    http://www.pageresource.com/dhtml/ryan/part2-2.html

    his sample is for referencing styles, but strip the .style out of the code and you have a function you pass the ID to which will return you a reference that will work in all browsers.


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
  •