Rotating A Banner On Schedule Via JavaScript / DOM
Recently asked on Yahoo! Answers:
No mouseover needed, the pictures will slowly swap on their own. I know this is a JavaScript, but don’t know the proper name for this function. Can anyone give me some guidance? All I need is the name of the function, I can look it up from there.
Thanks!!!!
This question should sound somewhat familiar to readers of this blog: We’ve dealt with displaying images based on the current time, randomly displaying an image, displaying an image based on user input and, earlier today, loading images, in order, every time a page is refreshed.
This question, therefore, wouldn’t seem that new. Except that we’re presented with two new challenges: We need not only retain what image to display next, we need to associate a URL with our image, too — so that people can click on the banner and go someplace.
As always, I have a working demo and downloadable code at the end of this discussion.
Continue reading: Rotating A Banner On Schedule Via JavaScript / DOM »
Loading A Specific Image Sequence On Page Refresh Via JavaScript / DOM
Recently asked on Yahoo! Answers:
Anyone have a Javascript that will allow me to change an image on reload in order and not by random?
I basically need it to change an image when the user clicks reload. The image loaded I dont want to be on a randomizer. I found a code that will basically load a random image on reload. Here it is. I see where the randomizer is but I don’t know how to get it out:
If I understand this question correctly, what this questioner wants to do is create an ordered list of images — Image 1, Image 2, Image 3, etc. — and display them, in order, with each page refresh.
This question is startlingly similar to the question I answered for displaying an image based on a schedule; in fact, we’ll use a similar approach here. But what this allows us to do is discuss how to use cookies in JavaScript — which is something new and fun.
As always, I’ll have a demo and code you can download at the end of the discussion.
Continue reading: Loading A Specific Image Sequence On Page Refresh Via JavaScript / DOM »
Showing A Larger Image From A Thumbnail OnClick Via JavaScript / DOM
Recently asked on Yahoo! Answers:
What Javascript to use to click on an image and make it appear larger in the middle of the page?
I want to display my artwork on my webpage. I want to have it so on the left hand side are small images of my work and in the middle will be a large area. When the viewer clicks on the small image (or rolls over it), the large image of the piece will be in the large box in the middle. What javascript code should I use?
This is DOM manipulation in its simplest and purest form: Change an IMG tag’s source, alt and title attributes based on clicking a thumbnail.
I’ll make two demos: One that includes the thumbnails on the same page as the image to be displayed, and another that places the thumbnails in an IFRAME, so scrolling between the thumbnail and the full-sized image isn’t an issue.
Continue reading: Showing A Larger Image From A Thumbnail OnClick Via JavaScript / DOM »
Displaying An Image On A Web Page Based Upon The Current Time With JavaScript / DOM
Recently asked on Yahoo! Answers:
How do I run a photo based on a schedule on my website?? I’m using Microsoft Frontpage. I know HTML, but no other programming languages. HELP PLEASE?
This is fairly straightforward, provided we know what kind of schedule we want to use. Since the questioner didn’t give a specific schedule he wants to be on, I’ll provide three examples:
- The current hour, from 12 a.m. (midnight) to 11 p.m.;
- The current day, from Sunday through Saturday;
- The current part of the day: Early morning, morning, afternoon, evening.
We also want to make sure we’ve done the following:
- Resized all the images to be a common size; this will lessen the design issues we face.
- Placed all the images we want to use in the same directory.
- Written down all the names of the images we will use.
Display A Random Image With JavaScript / DOM
Recenly asked on Yahoo! Answers:
I have a folder which contains images
I am looking for a simple code to put in my homepage,
This code will display an image randomly from that folder.
Any one can come up with that code?
This is very easily accomplished via JavaScript and the DOM. All you need to know is the names of your photos and the path to the folder where they are contained; then, it’s as simple as changing an IMG element on your page.
Continue reading: Display A Random Image With JavaScript / DOM »

