View Single Post
  #5 (permalink)  
Old 07-31-2004, 01:23 AM
ADAM Web Design's Avatar
ADAM Web Design ADAM Web Design is offline
WebProWorld 1,000+ Club
 

Join Date: Dec 2003
Location: Toronto, Ontario, Canada
Posts: 2,217
ADAM Web Design RepRank 0
Default

A Javascript will work anywhere in the <head> or <body> of a document. While it is preferential to put the JScript in the head of a document (and in a separate .JS where possible), sometimes it is necessary or easier to put the JScript into the body of the document (e.g. if you're dynamically generating an array of pics to be used in conjunction with a randomly rotated image section).

It may not provide output code that HTML coders would like, but for the actual programmers it may be easier to understand.

As swstyles pointed out, some JScripts (such as a DHTML menu) will only work within the body of a document.
Reply With Quote