Results 1 to 3 of 3

Thread: Where to place a script

  1. #1
    Join Date
    May 2007
    Posts
    31
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Where to place a script

    I've noticed that some scripts are contained in an external file while most are in the HEAD tag. But then you get some scripts that are placed in the BODY.

    Is there any basic rule that would help me and my fellow newbies on where to put a script?

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Most of the time, you can put things on the <head> tag. Follow your script's instructions just to be sure.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    There are 4 places to put scripts:
    1. In an external file-- this will then have to be grabbed by the page with code in one of the following sections.
    2. In the head section-- most everything goes here.
    3. In the body, where it should work-- if you want to put this, for example, next to a link and have it relate to that link, that can work. this isn't as common but happens sometimes, and can usually be associated with more code in the head section.
    4. After the body, before the end of the html-- I don't know if this is even valid, but I know that some script suggest this-- but it's rare.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •