I met some guys from Perth Web Design and their insights were very enlightening that is why I am sharing you some of the things that I have learned from the meeting.
Adding a dynamic-state to web design through client-side scripting
Writing or changing scripts is fairly simple. If you were to change the client-side scripts, it is like changing a typical HTML document. As soon as you refresh the document on the browser, the change is immediately executed. Client scripts are processed in different times depending on the way that they have been written. For example; statements can appear in a script block although it is not part of a procedure, function or subroutine. These are what you call as global or inline scripts that are processed when the browser reads the page. Statements can also appear as a part of a procedure but they will not be executed immediately. They will first be parsed when the page is run to check for any syntax errors.
Scripts for event handling procedures, functions and subroutines may appear anywhere in the page but they will only be processed when necessary. You will usually find these types of scripts in the header of a page. Client-side scripts can also directly interact with a user by posting message boxes or dialog boxes. For example, if a user makes an error when entering a document, an error message will be displayed by the client script.