Regardless of whether it validates, it's considered best practices to
keep all <script> tags out of the body:
Curtesy of quirksmode.org

:: snip ::

Generally you place JavaScripts in the <head> of a page. Only when you
want to write a message in the page, you'll have to place the script
in the correct place in the HTML.

Placing scripts in the <head> makes sure that any functions are loaded
before the buttons, links or other things that call them are loaded.
If you put your scripts at the very end of a page, it is possible that
a user already sees part of the page including a button with a
JavaScript function call, while the rest of the page hasn't loaded
yet. Result: user pushes button and gets JavaScript Error Message
Alerts, because the browser can't find the script (yet).

:: snip ::

jQuery mitigates this issue with the $(document).ready() function,
regardless, all logical (JavaScript) and stylistic (CSS) resources
should be kept separate from your content (XHTML).

- jake

On Tue, Apr 8, 2008 at 11:11 AM, Mika Tuupola <[EMAIL PROTECTED]> wrote:
>
>
>  On Apr 8, 2008, at 6:06 PM, Jake McGraw wrote:
>
>
> > Mixing content and logic, a no no for "standardistas". It really
> > depends on how much content you have on any given page. I'd suggest
> > using both the head and "footer" methods to determine what provides
> > the best end user experience Vs what keeps your pages standard
> > compliant.
> >
>
>
>  All my sites validate perfectly with <script> tags just before closing
> </body>.  What standard are you talking about?
>
>
>
>  --
>  Mika Tuupola
>  http://www.appelsiini.net/
>
>

Reply via email to