Jumprit's Knowledge

Jumprit's knowledge and references to share.

Auto Update Web Pages Using JavaScript —

Step 1: Create JavaScript File

Create a plain text document and name it with a .js extension, for example masterscript.js. Using the JavaScript document.write method, enter the content you want to be displayed on every page like so:

document.write("<div style='color:blue; font-size:12pt;'>");
document.write("© Copyright Myname 2004");
document.write("</div>");

Note: You don’t need to include script tags in this file.

Step 2: Add JavaScript Code to Pages

On every page where you want the content to appear, insert the following code:

<script language="JavaScript" type="text/javascript" src="masterscript.js"></script>

To change the content on every page, edit the contents of the masterscript.js file.

😎

source: http://www.mediacollege.com/internet/javascript/page/update-multiple-pages.html


Categorised as: Javascript | Web



Leave a Reply