473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

every hour another background image

Hi everyone,

In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

I would like to do that on this page www.karta-zagreba.com

Tnx everyone!
Aug 13 '08 #1
8 2125
Jomba wrote:
In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.
document.body.style.backgroundImage = 'url('
+ (new Date()).getHours()
+ '.jpg)';

from 00:00 to 00:59 -0.jpg
from 01:00 to 01:59 -1.jpg
from 02:00 to 02:59 -2.jpg
....
from 23:00 to 23:59 -23.jpg

This code is preferrably placed in an onLoad-event of the body-tag.

Hope this helps,

--
Bart
Aug 13 '08 #2
In comp.lang.javascript message <51dac5b5-f31f-4938-9552-1712a54b21e6@z7
2g2000hsb.googlegroups.com>, Tue, 12 Aug 2008 23:56:59, Jomba
<iv*********@gmail.composted:
>
In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.
Do you mean for the image to be loaded only with the page, and remain as
long as the page remains displayed, or do you want a new image to be
fetched each hour, in the manner of a clock? To get a good answer, a
good question is required.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Aug 13 '08 #3
sory, my english is not very well, so I ask only short Q :)

When someone open page, image remain as long as the page displayed.

"Dr J R Stockton" <jr*@merlyn.demon.co.ukje napisao u poruci interesnoj
grupi:r+**************@invalid.uk.co.demon.merlyn. invalid...
In comp.lang.javascript message <51dac5b5-f31f-4938-9552-1712a54b21e6@z7
2g2000hsb.googlegroups.com>, Tue, 12 Aug 2008 23:56:59, Jomba
<iv*********@gmail.composted:
>>
In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

Do you mean for the image to be loaded only with the page, and remain as
long as the page remains displayed, or do you want a new image to be
fetched each hour, in the manner of a clock? To get a good answer, a
good question is required.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF2 Op9
Sf3
news:comp.lang.javascript FAQ
<URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates,
sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items,
links.
Aug 13 '08 #4
In comp.lang.javascript message <3eb4fa97-80ed-49fb-99c4-4e28f74061f3@34
g2000hsh.googlegroups.com>, Wed, 13 Aug 2008 03:42:28, Bart Van der
Donck <ba**@nijlen.composted:
>Jomba wrote:
>In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

document.body.style.backgroundImage = 'url('
+ (new Date()).getHours()
+ '.jpg)';
At a given instant, you and I will see different images. If that is not
wanted, use getUTCHours().

====

I see a bug with Firefox 2.0.0.16 : Menu Help, Check for Updates reports
"There are no new updates available". But <http://www.mozilla-
europe.org/en/firefox/truthfully says to me "Firefox 3 Free Download
Windows (3.0.1, English (British), 7MB)".

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk BP7, Delphi 3 & 2006.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htmclpdmFAQ;
NOT <URL:http://support.codegear.com/newsgroups/>: news:borland.* Guidelines
Aug 14 '08 #5
Dr J R Stockton wrote:
In comp.lang.javascript message
<3eb4fa97-80ed-49fb-99c4-4e28f74061f3@34 g2000hsh.googlegroups.com>,
Wed, 13 Aug 2008 03:42:28, Bart Van der Donck <ba**@nijlen.com>
posted:
>>Jomba wrote:
>>In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

document.body.style.backgroundImage = 'url('
+ (new Date()).getHours()
+ '.jpg)';

At a given instant, you and I will see different images. If that is
not wanted, use getUTCHours().

====

I see a bug with Firefox 2.0.0.16 : Menu Help, Check for Updates
reports "There are no new updates available". But
<http://www.mozilla- europe.org/en/firefox/truthfully says to me
"Firefox 3 Free Download Windows (3.0.1, English (British), 7MB)".
How is that a bug? Firefox 3 is not an Update to Firefox 2.
Aug 14 '08 #6
On Aug 13, 4:56*pm, Jomba <ivanbaga...@gmail.comwrote:
Hi everyone,

In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.
Have you considered changing the image on the server? Every hour you
could replace say 'background.jpg' with a copy of a different image,
also called 'background.jpg'.
--
Rob
Aug 14 '08 #7
RobG wrote on 14 aug 2008 in comp.lang.javascript:
On Aug 13, 4:56*pm, Jomba <ivanbaga...@gmail.comwrote:
>Hi everyone,

In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

Have you considered changing the image on the server? Every hour you
could replace say 'background.jpg' with a copy of a different image,
also called 'background.jpg'.
Better use dedicated 404.asp for that:

<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))
if right(qstr,15)="/background.jpg" then
response.redirect "/myDir/myHourPic" & hours(now) & ".jpg"
end if
%>
You have reached my 404 page.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 14 '08 #8
Evertjan. wrote on 14 aug 2008 in comp.lang.javascript:
RobG wrote on 14 aug 2008 in comp.lang.javascript:
>On Aug 13, 4:56*pm, Jomba <ivanbaga...@gmail.comwrote:
>>Hi everyone,

In folder image i have 24 pictures, and i would like to have some
javascript that will every hour put another picture as background
image.

Have you considered changing the image on the server? Every hour you
could replace say 'background.jpg' with a copy of a different image,
also called 'background.jpg'.

Better use dedicated 404.asp for that:

<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))
if right(qstr,15)="/background.jpg" then
response.redirect "/myDir/myHourPic" & hours(now) & ".jpg"
end if
%>
You have reached my 404 page.

Or just do:

<img src='mySwitchingJpg.asp'>

=========== mySwitchingJpg.asp ============
<% 'vbs
Response.Expires = -100
response.redirect "/myDir/myHourPic" & hours(now) & ".jpg"
%>
===========================================

sorry vbs, OT.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 15 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: erik | last post by:
Is it posssible to inherit the previous pages (parent pages) background image? Is there a script out there I could look at? Thanks
3
by: src_mag | last post by:
Hello, I'd like to write JavaScript code that refreshes a frame once a second loading a different image each time. Basically, here's what the script would do: 0 sec load img0.gif 1 sec load...
13
by: Giggle Girl | last post by:
Hi there, I need to use a background image in a TR that does NOT restart everytime it hits a TD. Can it be done? Specifically, if you set a background image for an entier table, now mater how...
3
by: Viken Karaguesian | last post by:
Hello all, I need somehelp with background tiling. I have a sneaking suspicion that what I want to do is not possible, but I'll ask anyway. :>) First some background: Here's the site in...
1
by: vijay.db | last post by:
Hi Team, Very serious problem with my DB2 V8.1 Fixpack 6 running in AIX 5.1 machine. Every one hour my DB2 instance processes are killed and it's going down. Several trap files are generated in...
4
by: vunet.us | last post by:
Hi, I found a bug in IE6, though it is known already. If I have a CSS background property set to some image, such as background:url(myimg.gif);, and I apply this property to some html element,...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
1
by: praveenb000 | last post by:
Hi every one, I designed a web page, having horizontal menu using UL and LI tags; I need to be set rollover effect for a menu items. whenever user hover on a menu item, the entire...
2
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.