Or, you can load the js files after you html > body is loaded/parsed.
It's a good practice (IMO).


<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml";>
  <head>
    <title>My testing page</title>
  </head>
  <body>
    <div>
      <!-- all stuff goes here. -->
    </div>

    <script src="prototype.js" type="text/javascript"></script>
    <script type="text/javascript" src="script.js"></script>
  </body>
</html>


On Thu, Jul 16, 2009 at 1:54 PM, ColinFine<colin.f...@pace.com> wrote:
>
>
>
> On Jul 16, 1:22 am, "bambell...@hotmail.com" <bambell...@hotmail.com>
> wrote:
>> I've made a quick search on Google and realised it's because the
>> sliders are being created before the HTML elements are initialised (as
>> script.js loads in the header).
>> I used a setTimeout and it now works fine! Thanks anyways!
>
> A *much* better approach is to use an event, and Prototype provides
> one specially for you:
>
> document.observe('dom:loaded', function () {
>  // Any code that depends on the DOM being completely loaded
> })
> >
>



-- 
Believe nothing, no matter where you read it, or who said it, no
matter if I have said it, unless it agrees with your own reason and
your own common sense.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to