A quick html / js tip (as recorded in my palm’s MemoDB)

How to use External Javascripts to keep links etc the same over various pages in a web site

2005-04-12

Create Javascript with appropriate text

function bottom_links()
{
document.write('<p>');
document.write('<a href="#top">Top</a> ');
document.write('|  ');
}

Save the file as file.js

Import the JS file into your html file

Type the following into the <head> section of the html file:

<SCRIPT language="JavaScript" SRC="file.js"></SCRIPT>

Call the function somewhere in the html file and the text will be inserted as programmed

<SCRIPT language="JavaScript">bottom_links()</script>

You can now change the links as you like and all the pages where the java is used can show the updated text!!

Wow. It's Quiet Here...

Be the first to start the conversation!

Leave a Reply:

Gravatar Image

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>