View Full Version : help separating it into a .js file

07-12-2012, 07:51 AM
ok so im trying to separate out my code to make it easier to edit, since I use the same code through multiple pages, I have the style.css sheet down pat, and I header somewhere that you could use a .js page to display additional information in the same page, well my problem is, I don't know .js too well, im still learning,
so without putting my style sheet on here, how would I go about altering this page to link my links to a .js file or two?

<html xmlns="http://www.w3.org/1999/xhtml">
<meta name="description" content="" />
<meta name="keywords" content="" />
<title>Big Business 2.0 by FCT</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />

<div id="logo">
<a href="home.html"><img src="img.png" border="0"></a>
<div id="banner">
<img src="http://i44.photobucket.com/albums/f11/master-of-time/Cox/newbanner.jpg">
<div id="clock">
<iframe src="http://free.timeanddate.com/clock/i35x3s8s/n127/fn6/fs16/fc9ff/tct/pct/tt0/th2/tb1" frameborder="0" width="357" height="24" allowTransparency="true"></iframe>
<div id="digi">
<a href="sub/google.html"><img src="digi.png" border="0"></a>
<div id="home">
<a href="home.html"><font size="5" >Home</font></a>

<div id="links">
<li><a href=".html">left link1</a></li>
<li><a href=".html">left link2</a></li>
<li><a href=".html">left link3</a></li>
<li><a href=".html">left link4</a></li>
<li><a href=".html">left link5</a></li>
<li><a href=".html">left link6</a></li>
<li><a href=".html">left link7</a></li>
<li><a href=".html">left link8</a></li>
<li><a href=".html">left link9</a></li>
<br />
<li>Trouble Shooting
<li><a href=".html">left link10</a></li>
<li><a href=".html">left link11</a></li>
<li><a href=".html">left link12</a></li>
<div id="links2">
<li>Other Information
<li><a href=".html">right link1</a></li>
<li><a href=".html">right link2</a></li>
<li><a href=".html">right link3</a></li>
<li><a href=".html">right link4</a></li>
<li><a href=".html">right link5</a></li>

<div id="egg">
<a href="easteregg.html"><img src="http://i44.photobucket.com/albums/f11/master-of-time/Cox/egg.jpg" border="0"></a>


07-13-2012, 07:04 AM
If I'm right, you're trying to make a reference to an external JavaScript script. This is just basically the same as you did with the CSS, except it is:

<script type="text/javascript" src="filename.js">