Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. getElementById - How many people still code for browsers that don't upport this?

getElementById - How many people still code for browsers that don't upport this?

Scheduled Pinned Locked Moved Web Development
javascriptcollaborationquestion
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MartinSmith
    wrote on last edited by
    #1

    I work in a web development team of 2 people. I always just use document.getElementById('blah') My co-worker always uses a "getLayerObj" function and includes a reference to a 24KB javascript file (dynlib.js) just to use this. function getLayerObj(LAYERID) { if (ie4) return document.all[LAYERID]; else if (ns4) { var tempLayerObj = null; var tempParentObj = (arguments.length == 1) ? document : arguments[1]; for (var tempLayerLoop in tempParentObj.layers) { var tempObj = tempParentObj.layers[tempLayerLoop]; var tempConstructor = tempObj.constructor + ''; if (tempConstructor.indexOf('function Layer()') != -1) { if (tempLayerLoop == LAYERID) return tempObj; else if (tempObj.document.layers.length > 0) tempLayerObj = getLayerObj(LAYERID,tempObj); } } return tempLayerObj; } else if (dyn) return document.getElementById(LAYERID); } My opinion is this is unnecessary. I'm trying to get a feeling for whether mine is a minority or majority view so I'd be grateful hearing what everyone elses practice is? Cheers.

    F S 2 Replies Last reply
    0
    • M MartinSmith

      I work in a web development team of 2 people. I always just use document.getElementById('blah') My co-worker always uses a "getLayerObj" function and includes a reference to a 24KB javascript file (dynlib.js) just to use this. function getLayerObj(LAYERID) { if (ie4) return document.all[LAYERID]; else if (ns4) { var tempLayerObj = null; var tempParentObj = (arguments.length == 1) ? document : arguments[1]; for (var tempLayerLoop in tempParentObj.layers) { var tempObj = tempParentObj.layers[tempLayerLoop]; var tempConstructor = tempObj.constructor + ''; if (tempConstructor.indexOf('function Layer()') != -1) { if (tempLayerLoop == LAYERID) return tempObj; else if (tempObj.document.layers.length > 0) tempLayerObj = getLayerObj(LAYERID,tempObj); } } return tempLayerObj; } else if (dyn) return document.getElementById(LAYERID); } My opinion is this is unnecessary. I'm trying to get a feeling for whether mine is a minority or majority view so I'd be grateful hearing what everyone elses practice is? Cheers.

      F Offline
      F Offline
      Fred_Smith
      wrote on last edited by
      #2

      I'm with you: getElementById is recognised by all modern browsers on both PC and Mac, and IMHO if anyone wants to use something else that's their lookout; It's hard enough (well, ok, time-consuming enough) to code HTML, CSS and Javascript to cope with the major browsers and platforms without having to pander to *every* alternative out there. Somewhere down the line, users have to take responsiblity by using compliant browsers. Compliant browsers? Someone's going to say "That rules out IE then!" No it doesn't... I'd like someone to tell me by what right w3c and their affiliates determine standards? I don't remember voting for them any more than Microsoft... in fact, I *did* vote for Microsoft:- with my wallet by buying their products. Fred

      G 1 Reply Last reply
      0
      • M MartinSmith

        I work in a web development team of 2 people. I always just use document.getElementById('blah') My co-worker always uses a "getLayerObj" function and includes a reference to a 24KB javascript file (dynlib.js) just to use this. function getLayerObj(LAYERID) { if (ie4) return document.all[LAYERID]; else if (ns4) { var tempLayerObj = null; var tempParentObj = (arguments.length == 1) ? document : arguments[1]; for (var tempLayerLoop in tempParentObj.layers) { var tempObj = tempParentObj.layers[tempLayerLoop]; var tempConstructor = tempObj.constructor + ''; if (tempConstructor.indexOf('function Layer()') != -1) { if (tempLayerLoop == LAYERID) return tempObj; else if (tempObj.document.layers.length > 0) tempLayerObj = getLayerObj(LAYERID,tempObj); } } return tempLayerObj; } else if (dyn) return document.getElementById(LAYERID); } My opinion is this is unnecessary. I'm trying to get a feeling for whether mine is a minority or majority view so I'd be grateful hearing what everyone elses practice is? Cheers.

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #3

        Very, very, very few people still use Netscape 4, even fewer IE4. If you're aiming at the general population, your time would be better spent making sure Opera and Safari or even the last Mac IE render properly. Unless you are stuck supporting in-house users that are all deeply in love with it, i'd drop IE4/NS4 support faster than a hot chunk of iron. Heck, even if you do have NS4 users in-house, your time would probably be better spent upgrading them to FF or IE7. This is hardly the only work-around you'd need to properly support such older browsers.

        ----

        It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.

        --Raymond Chen on MSDN

        M 1 Reply Last reply
        0
        • S Shog9 0

          Very, very, very few people still use Netscape 4, even fewer IE4. If you're aiming at the general population, your time would be better spent making sure Opera and Safari or even the last Mac IE render properly. Unless you are stuck supporting in-house users that are all deeply in love with it, i'd drop IE4/NS4 support faster than a hot chunk of iron. Heck, even if you do have NS4 users in-house, your time would probably be better spent upgrading them to FF or IE7. This is hardly the only work-around you'd need to properly support such older browsers.

          ----

          It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.

          --Raymond Chen on MSDN

          M Offline
          M Offline
          MartinSmith
          wrote on last edited by
          #4

          Thanks for the responses so far. We're not trying to support IE4 and NS4 explicitly, we don't test our sites in them and I know for a start the code I've written won't work in them as well as very likely things like our tree view and menu controls and pages that use AJAX! Related to Shog's point actually and going off on a bit of a tangent does anyone know where I can get reliable browser usage stats for the web as a whole? I know the w3c stats page but it's not a representative sample. Do any of the mega sites (e.g. Google, Yahoo, Microsoft) make their stats available anywhere?

          S 1 Reply Last reply
          0
          • M MartinSmith

            Thanks for the responses so far. We're not trying to support IE4 and NS4 explicitly, we don't test our sites in them and I know for a start the code I've written won't work in them as well as very likely things like our tree view and menu controls and pages that use AJAX! Related to Shog's point actually and going off on a bit of a tangent does anyone know where I can get reliable browser usage stats for the web as a whole? I know the w3c stats page but it's not a representative sample. Do any of the mega sites (e.g. Google, Yahoo, Microsoft) make their stats available anywhere?

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5

            MartinSmith wrote:

            Related to Shog's point actually and going off on a bit of a tangent does anyone know where I can get reliable browser usage stats for the web as a whole?

            Short answer: you can't. Longer answer: the reliability of any statistics based on user agent strings is somewhat poor; while well-behaved spiders will identify themselves as such, there are plenty of spam bots and site scrapers that will identify themselves as browsers to avoid detection. And even if this wasn't true, unless you're setting up the next Google or Y!, Google and Y! stats aren't even applicable - you might have a very different set of users, and browsers that are a tiny minority among visitors to those sites could be a sizable percentage of visitors to yours - or completely non-existent. The best suggestion i can give you (if your site is already live) is to analyze your own logs or use a service such as Google Analytics[^] to collect information on who is visiting with what browser. And then, take it with a grain of salt. ;)

            ----

            It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.

            --Raymond Chen on MSDN

            M 1 Reply Last reply
            0
            • S Shog9 0

              MartinSmith wrote:

              Related to Shog's point actually and going off on a bit of a tangent does anyone know where I can get reliable browser usage stats for the web as a whole?

              Short answer: you can't. Longer answer: the reliability of any statistics based on user agent strings is somewhat poor; while well-behaved spiders will identify themselves as such, there are plenty of spam bots and site scrapers that will identify themselves as browsers to avoid detection. And even if this wasn't true, unless you're setting up the next Google or Y!, Google and Y! stats aren't even applicable - you might have a very different set of users, and browsers that are a tiny minority among visitors to those sites could be a sizable percentage of visitors to yours - or completely non-existent. The best suggestion i can give you (if your site is already live) is to analyze your own logs or use a service such as Google Analytics[^] to collect information on who is visiting with what browser. And then, take it with a grain of salt. ;)

              ----

              It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.

              --Raymond Chen on MSDN

              M Offline
              M Offline
              MartinSmith
              wrote on last edited by
              #6

              Good Points. I'd better dust off my LogParser queries!

              1 Reply Last reply
              0
              • F Fred_Smith

                I'm with you: getElementById is recognised by all modern browsers on both PC and Mac, and IMHO if anyone wants to use something else that's their lookout; It's hard enough (well, ok, time-consuming enough) to code HTML, CSS and Javascript to cope with the major browsers and platforms without having to pander to *every* alternative out there. Somewhere down the line, users have to take responsiblity by using compliant browsers. Compliant browsers? Someone's going to say "That rules out IE then!" No it doesn't... I'd like someone to tell me by what right w3c and their affiliates determine standards? I don't remember voting for them any more than Microsoft... in fact, I *did* vote for Microsoft:- with my wallet by buying their products. Fred

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Fred_Smith wrote:

                I'd like someone to tell me by what right w3c and their affiliates determine standards? I don't remember voting for them any more than Microsoft...

                If you check the W3C member list[^], you will see the Microsoft Corporation is one of them.

                --- single minded; short sighted; long gone;

                F 1 Reply Last reply
                0
                • G Guffa

                  Fred_Smith wrote:

                  I'd like someone to tell me by what right w3c and their affiliates determine standards? I don't remember voting for them any more than Microsoft...

                  If you check the W3C member list[^], you will see the Microsoft Corporation is one of them.

                  --- single minded; short sighted; long gone;

                  F Offline
                  F Offline
                  Fred_Smith
                  wrote on last edited by
                  #8

                  Well of course they would be. That's politics for you. Point is though, Microsoft are the big boys, the winners if you will, and the winners always write the history...and set the standards. What's the point in winning otherwise? Why strive to run faster than everyone else if someone else is going to come along and say you're not allowed to run faster than your competitors? Fred The line it is drawn The curse it is cast The slow one now Will later be fast As the present now Will later be past The order is Rapidly fadin'. And the first one now Will later be last For the times they are a-changin'.

                  G 1 Reply Last reply
                  0
                  • F Fred_Smith

                    Well of course they would be. That's politics for you. Point is though, Microsoft are the big boys, the winners if you will, and the winners always write the history...and set the standards. What's the point in winning otherwise? Why strive to run faster than everyone else if someone else is going to come along and say you're not allowed to run faster than your competitors? Fred The line it is drawn The curse it is cast The slow one now Will later be fast As the present now Will later be past The order is Rapidly fadin'. And the first one now Will later be last For the times they are a-changin'.

                    G Offline
                    G Offline
                    Guffa
                    wrote on last edited by
                    #9

                    Fred_Smith wrote:

                    Well of course they would be. That's politics for you. Point is though, Microsoft are the big boys, the winners if you will, and the winners always write the history...and set the standards.

                    But as they are members, that makes your point pointless. Microsoft is part of the group that has set the standards, and that group is W3C. By being a member, Microsoft has acknowledged W3C as being the group that sets the standards.

                    --- single minded; short sighted; long gone;

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups