Handling Multiple Scripts on Web Page
Introduction This article shows how to handle multiple scripts on web page. Actually the traditional mechanism for registering even handlers through JavaScript is to assign a function to the DOM (Document Object Model) element's corresponding attribute. For example, suppose we had a function: function doStuff() { document.writeln( "my test line" ); } Now, we could then either assign it within our HTML markup: < body onload ="doStuff();"> </ body > Or, we could assign it from within JavaScript code:~ window.onload = doStuff(); Here is the complete design: Both approaches will cause the function to execute when the page is loaded. But the advantage of the second is that the behavior is more cleanly separated from the markup. This strategy works quite well with one function. Let's suppose we have another function: function doStuff() { document.writeln