JavaScript and Java applets can do almost the same thing, but Java is more versatile. Java can do networking and database query functions, for example. JavaScript is interpreted by the browser, and loads a LOT faster than Java applets. Java is class-based with strong data typing. Java vs. JavaScript plus information on how to embed JavaScript , a tutorial from Netscape.
Event Handlers are methods or functions that are invoked upon the occurrence of the event.
For example, upon passing the mouse over a link, an onMouseOver event, a text layer appears or the status text changes. Functions are a collection of JavaScript statements to be performed. Functions remove the need to execute the same set of statements written in different places in a web page. Functions are written once and can be accessed from different places in a web page. Functions differ from methods in that they are not necessarily associated with a particular object.