|
-
Jul 28th, 2000, 08:47 AM
#4
Lively Member
well mate, you had it in you code I think, lemme c what i can whip up from my head again..I bet when I have finished it still wont work, but i am too lazy to actually test it out myself, ok here goes:
Code:
<html>
<head>
<title>JS to Rotate Banners</title>
</head>
<script language=javascript type="text/javascript">
var img1 = Image(); //global
var img2 = Image(); //variables
function init() {
img1.src = "img1.jpg"; //this will preload
img2.src = "img2.jpg"; //the images
setInterval("fPrepare()", 1500); //set the time u want
}
function fPrepare() {
if(document.images['banner'].src == img1.src) {
cng(img2.src); //img1 & 2.src should be visible
//to this function as it is global
}
else {
cng(img1.src);
}
}
function cng(imgSrc) {
document.images['banner'].src = imgSrc;
}
</script>
<body onLoad="init()">
<img src="" id="banner" width="200" height="20">
</body>
</html>
This i am afraid isn't the best code I have ever written but I hope you can learn from it, and implement it to work better (if it works)...it is very sloppy, but the best i can do without testing it, and with no references, but I think that should all work with both browsers, after all it is very simple code. If you need more help then I will have to install netscape and try it myself.
Mag-Net's Home
Visual Studio 6-Enterprise - SP4
ICQ: 35519773
Have Fun 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|