Microsoft Corporation
Updated June 10, 1999
You can consolidate scripts in a global file that can be referenced from pages in both compiled and uncompiled help systems. This makes it easier to maintain scripts that are used by many different pages, such as those used for image-swapping. This example shows a global file using JavaScript, but it will work with other Web scripting languages, such as Microsoft Visual Basic Scripting Edition.
There are three steps to implementing a global script file:
<SCRIPT>
tag to the <HEAD>
tag of each HTML file. This links the code in your global file to the page. The tag should look like this:
<script language="JavaScript" src="master.js"></script>
Where JavaScript
is the name of the scripting language you are using and master.js
is the name of the global script file.
You can call scripts that are stored in a global file the same way you would call script code that is actually on the page. For example, if you created a global file with function Foo()
, you could reference it like this: <a onclick="Foo()">
.
Tips and Tricks | |