object not found onload

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vadivasbro@hotmail.com

    #1

    object not found onload

    The onload event appears to be firing before all the content of my
    window loads or something. In the stripped down example below, my
    browser tells me that it cannot find the object "thisThing. " What
    gives?


    <html>
    <head>

    <script type="text/javascript">
    window.onload = document.getEle mentById("thisT hing").style.ba ckground =
    "red";
    </script>

    </head>
    <body>
    <div id="thisThing" style="height:4 0px; width:50px;
    background:blue ">
    </div>

    </body>
    </html>

  • Dietmar Meier

    #2
    Re: object not found onload

    vadivasbro@hotm ail.com wrote:
    [color=blue]
    > The onload event appears to be firing before all the content of my
    > window loads or something. In the stripped down example below, my
    > browser tells me that it cannot find the object "thisThing. "[/color]

    You've already got answers to that question last time you asked, e.g.


    ciao, dhgm

    Comment

    • Lee

      #3
      Re: object not found onload

      vadivasbro@hotm ail.com said:[color=blue]
      >
      >The onload event appears to be firing before all the content of my
      >window loads or something. In the stripped down example below, my
      >browser tells me that it cannot find the object "thisThing. " What
      >gives?
      >
      >
      ><html>
      ><head>
      >
      ><script type="text/javascript">
      >window.onloa d = document.getEle mentById("thisT hing").style.ba ckground =
      >"red";
      ></script>[/color]


      The onload event has nothing to do with your error.
      The error is that you're invoking document.getEle mentById("thisT hing")
      in the <head> section, before the page loads.

      Comment

      • 2obvious

        #4
        Re: object not found onload

        yeh...My bad, Dietmar.

        I post on Google. Up until its fairly recent changes, a search on my
        nickname ("2obvious") would skip me right to my latest post. Now,
        apparently, the nickname can be toggled. When I didn't see my latest
        post in a search, I assumed there was glitch and that I hadn't posted.
        Bad form on my part.

        Thanks for the link. Saves me the trouble of redirecting this post to
        a correct answer myself.

        --E.

        Comment

        Working...