aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes script placing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "script placing" Watch "script placing" New topic
Author

script placing

Hendra Kurniawan
Ranch Hand

Joined: Jan 31, 2011
Posts: 239
I wish to know what's the different if script in head and in body. Is there any difference on when and how the script is executed?


gave me original with error : p1 is null. can anybody explain why ? thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61434
    
  67

Well, look at the file. Does p1 exist when the script is encountered?

Some people will put the script at the end of the file, after the DOM has been constructed, and there are claims that this is more performant than other locations. (I have yet to see much of any difference.)

But most people will put initialization code in one of a load event handler, or a ready handler (if using jQuery).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: script placing