Home
JavaScript
.js Extension Files
.js or Javascript extension files are handy for storing information that you want to control across multiple HTML pages. One perfect use is the page footer. It is much easier to update footer information across a site when you only have one file to adjust.

Start with a footer that you have created for a page. We will turn this footer into a .js file.

    <hr>
    <center><font size="2">
    <a href="mailto:you@address.com">you@address.com</a>
    | 100 Main St., City, State | 800-111-1111
    </center>
Copy the footer information and paste it into a new page. Save the page as "footer.js". Now, edit the copy.

– Start by replacing any double quotes with the single quote.
– Begin each line of copy with: document.write("
– End each line of copy with: ")

The resulting file will look like:
    document.write("<hr>")
    document.write("<center><font size='2'>")
    document.write("<a href='mailto:you@address.com'>you@address.com</a>")
    document.write(" | 100 Main St., City, State | 800-111-1111")
    document.write("</center>")
Next, call out the script on your HTML page. Place the following line at the bottom of your HTML page, where you want the footer to appear.
    <script src="footer.js"></script>
If you have saved the footer.js within a different directory, use the path to that directory.