A function is a deferred script since it does not do anything till a function, an event, a JavaScript link, or an immediate script calls it. You have possibly noticed that you can call a function from a script. Sometimes you are interested in calling a function through the same script, and in other cases you may want to call it from another script. Both are possible.
Calling a function from the similar script is really simple. You just have to indicate the name of the function
<HTML>
<HEAD>
<TITLE>Calling deferred code from its own script</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- makeLine(30)
function makeLine(lineWidth) {
document.write("<HR SIZE=" + lineWidth + ">")
}
makeLine(10)
// -->
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>