So, this script I’m using on my homepage
(http://danmoriarty.com), to rotate .jpg images,
that only seems to work when it’s embedded
in that page’s code.
When I try to add it to my external .js file, with
my other javascript code, it fails to work.
Anyone know why?
Here’s the code:
webImages = new Array("images_websites/150_clh.jpg", "images_websites/150_primo.jpg", "images_websites/150_lexmar.jpg") webURL = new Array("portfolio_web/web.php?body=clh", "portfolio_web/web.php?body=primo", "portfolio_web/web.php?body=lexmar") thisSite = 0 imgCt= webImages.length
function rotate() { if (document.images){ if (document.webBanner.complete){ thisSite++ if (thisSite ==imgCt){ thisSite= 0 }
document.webBanner.src=webImages[thisSit e] } setTimeout("rotate()", 4 * 1000) } }
function newLocation() { document.location.href = "http://danmoriarty.com/" + webURL[thisSite]
}
also:
I’m trying to learn javascript. Thanks much.