ok, im trying to link an external js file to a page, so that i dont have loads of js in the head. its a slide show. and when its in the head, it works. but i copy it identically and link it correctly into an external file and the slide show doesn't run. i think i have to change something in the document.slideshow.src, but im not sure. anyway,
HTML DOCUMENT SOMEWHERE WHERE I WANT THE SLIDESHOW TO RUN
<head>
<script src="scripts/slideshow.js" type="text/javascript"></script>
</head>
<body>
<img src="images/items/na35030.jpg" name="slideshow" border="0">...
EXTERNAL JS SLIDESHOW
var curArrival = 0;
var startRunning;
var arrivals = new Array(4);
arrivals[0] = "../images/items/na35030.jpg";
arrivals[1] = "../images/items/na35046.jpg";
arrivals[2] = "../images/items/na35278.jpg";
arrivals[3] = "../images/items/na35330.jpg";
function slide(){
if (curArrival == 3) {
curArrival = 0;
}
else {
++curArrival;
}
document.slideshow.src = arrivals[curArrival];
}
setInterval('slide()',2000);
August 4 2005, 13:36:04 UTC 6 years ago
August 4 2005, 16:48:58 UTC 6 years ago