SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript body onload function

    Hi,

    I have this command called <body onload="fillup();">

    The problem is I believe that this loads it up after the entire page has loaded.

    Is there a way to load it up at the beginning even before a page has completely loaded?

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Javascript operates on the DOM tree. WIthout a DOM tree (completely parsing the tree), there wouldn't be anyway for JavaScript to operate properly.

  3. #3
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    makes sense

  4. #4
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easy - move it immediately after the body tag.
    Code:
    <body>
    <script type="text/javascript"><!--
      fillup(); 
    --></script>
    Just be wary about tugging on objects that don't exist yet, as Chris mentioned - but if your routine is just outputting HTML direct or manipulating stuff apart from page content, that should work fine.


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
  •