Click to See Complete Forum and Search --> : Banner Rotation


Webbie2003
04-02-2003, 07:40 PM
Hello All

I am still pretty much a novice in web design and
need some assistance with banner rotation ... ( preferably something simple and not to complicated to set up ).

I would like to display 3 banners at the top of my homepage , however, I would like the banners to rotate every 4 seconds or so continuously .

Ex :

Banner 1 ... display for 4 seconds then ....switch to ...
Banner 2 ... display for 4 seconds then .... switch to ...
Banner 3 ... display for 4 seconds then .... switch to ...

Then Back To Banner 1 etc ...

The 3 banners have already been created .

Thank You

Nedals
04-02-2003, 08:12 PM
<html><head><title>Untitled</title>
<script type="text/javascript">
<!--
var banners = new Array('sample1.jpg','sample2.jpg','sample3.jpg');
// preload the images
var imgAry = new Array();
for (var i=0; i<banners.length; i++) { imgAry[i] = new Image; imgAry[i].src = banners[i]; }

i=0;
function swap() {
document.banner.src = "images/"+banners[i]; i++;
if (i>=banners.length) i = 0;
timer = setTimeout("swap()",1000);
}
onload = swap;
//-->
</script>
</head>

<body>
<img src="images/sample1.jpg" name="banner">
</body>
</html>

Simply add image names to the banner array for more pictures.
Time is set to 1 sec (1000 mSec)

Webbie2003
04-02-2003, 09:33 PM
Thanks

I have a question or 2

(1) Can I adjust the time from 1 second ???

(2) Do I need to plug in any banner values ... width , height ???

Thank

Nedals
04-03-2003, 12:14 AM
Originally posted by Webbie2003
(1) Can I adjust the time from 1 second ???
(2) Do I need to plug in any banner values ... width , height ???

1. timer = setTimeout("swap()",1000);
Change this value (1000 per sec) ie 4000 = 4sec
2. Yes. And width and height should be the same for each banner image. To be fully compliant, you should also include an 'alt="banner description"'

Webbie2003
04-03-2003, 12:36 AM
Thank You ...

2." Yes. And width and height should be the same for each banner image. To be fully compliant, you should also include an 'alt="banner description"'."....

Now , can U tell me where I should plug the above in ???

Nedals
04-03-2003, 01:16 AM
I am still pretty much a novice in web design
Time for you to go study... :)

<img src="images/sample1.jpg" name="banner" alt="rotating banner" width=400 height=30>

And please don't ask how to change the image size. :)

Webbie2003
04-03-2003, 04:34 PM
Hmmmmm ....

What an interesting response .... Didn't expect this here ...

Actually , I was under the impression that this was a HELP forum ...

WeLL , First Of All ....
Let me back up a bit and define Novice ...

NOVICE : Beginner : Somebody who has just started learning or doing something new and has no previous experience in the skill or activity !

Now to proceed ....

I came to this forum after being referred by another student on the web who stated that this was a forum with an professional environment with people here who take time offer their HELP and experience without attempting to treat people like they are less than or stupid like often occurs in other forums which have a help environment .

I AM a NOVICE ( read the definition please ) in the web design field and so far have some experience in HTML NOT JS .

For someone like myself who isnot versed in JS , It may be rather hard to look at the script presented and decipher it's contents or to tell exactly where one should plug values or do any modification to ( correctly ) ...

Therfore I ASK ... which is how one LEARNS !

I came here for HELP and maybe LEARN some things from those more experienced than myself .

I DIDNOT come here to be insulted or be met by snide remarks .... Or for someone to tell me to go study or NOT to ask questions .:)

Up to this point , my experience(s) here have been pleasant .
I have made a few other post ... under my own user name and along with other students and have never encountered any sort of distaste frm others here ... only a willingness to assist and /or elaborate if need be and I must admit I as well as other students who have read this post are shocked by seeing the remarks in this post .


Basically ...

If you DONOT want others to ask questions about YOUR presented work ... DON'T present your work .:)

As for your presented script ...

Thank You , However , I have been contacted directly by email from 4 others whom not only offered working scripts , but, offered to answer any questions I may have ( and have done so ) and suggested I ignore the ignorance of the author at hand here .

It was real good to see that everyone here doesnot share the same somber viewpoint as the author .

I have definitely learned some things here about Java script now Thanks to those understanding individuals via email .;)

Webbie : NOVICE ... ( read the definition please ) :) :)

Nedals
04-03-2003, 11:57 PM
I DIDNOT come here to be insulted or be met by snide remarks
My intent was certainly not intended to insult, only to suggest that you read up on BASIC HTML and Javascript

I AM a NOVICE ( read the definition please ) in the web design field and so far have some experience in HTML NOT JS .
Which is why I gave you a pointer on how to set the time. But it appears that you neglected to read my earlier postpost.

timer = setTimeout("swap()",1000);
Time is set to 1 sec (1000 mSec)

Now , can U tell me where I should plug the above in ??? (sic: width, height and alt in an image tag)
This is basic HTML which you state your have experience with. Hence my recommendation that you read up on HTML

If my writing style happen to hurt your feelings, it was not my intent. I prefer to point people in the right direction rather than
providing a complete solution. In your case I gave you a complete, tested working solution.

And please don't ask how to change the image size.:) was supposed to be humorous. You obviously took it the wrong way.

Webbie2003
04-04-2003, 07:31 AM
Nedals ...

Hmmmm ...

In reading your last response ...

Maybe I did take things the wrong way and for this I do apologize as well .

I didnot realize at the time that it was intended as humor .

I am not here to fight ... just wanna Have Fun , Meet positive people and Learn .... just want Brain Power ... Knowledge ... expand the head circuits , ya know !!!

This particular forum came very highly recommended to us by other students and a few professors also and in lurking around I see why .

Think I am Gonna Like It Here Too !!!

Thanks for your followup post .

Peace Out

Webbie