PDA

View Full Version : Where to place a script



burginsteve
04-06-2008, 08:28 AM
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?

tech_support
04-06-2008, 08:31 AM
Most of the time, you can put things on the <head> tag. Follow your script's instructions just to be sure.

djr33
04-06-2008, 08:58 AM
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.