kellibean1984 ([info]kellibean1984) wrote,
  • Mood: confused

javascript question

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);

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    Your IP address will be recorded 

  • 2 comments

[info]codexarcanum

August 4 2005, 13:36:04 UTC 6 years ago

I can think of a few things that might be going wrong, but I'd rather not insult you by just randomly suggesting myriads of things. Maybe I can help when you come into work today and I can look at the full code?

[info]kellibean1984

August 4 2005, 16:48:58 UTC 6 years ago

oh wow. i just got it to work. hmm. maybe cuz it was so late last night i was missing something stupid. lol. thanks tho. ^_^
Create an Account
Forgot your login or password?
Facebook Twitter More login options
English • Español • Deutsch • Русский…