Hi, i found this script around. and need some help tomake it works as i wish.
to add minuts and seconds so can change the background ex. 07:45:00 instead of just hours only.
The code you posted does not display the time in any form.
It only selects the picture to display between a particular hour of the day.
You could expand on this to display different pictures for every hour of the day
but there is no logic to determine what is to be displayed with min:sec values.
If you want the actual time display to change with min:sec,
you need to provide some more code to where the time is set and displayed,
not just a function to determine what images are displayed.
BTW: You should enclose you code between [ code] and [ /code] tags (without the spaces)
to make it stand out better in your posting.
thanx for response JMRKER,
this is true the script pictures but in hours i need to add minuts and second this is what i want to display pictures ex. 7.30 or maybe 8.45 this is my point.
thanx anyway.
can u plz rescript it for me itryed but no results.
regards
it is actully mp3 files instead pictures but almost same script and it has to be 5 times
morning 5.30
noon 12.15
afternoon 15.25
evening 19.05
night 22.10
is it possible to play around this script to make it redirect to another page in an iframe?
thank you again!!
if yes plz help me
Probably yes.
You will need to define what it is that you are trying to do for me.
I'm tired of guessing what you want to do and then you changing the requirements.
Define what you want before you begin the design/implementation phase.
Show some code.
i want to make 365 days in each day changings 5 times images and 5 to 6 mp3 bg music in 2 diffrent iframes
the music must be diffrent URL's cause it's radio stations and look at this ex.
Code:
<script language="JavaScript" type="text/javascript">
<!-- Copyright 2007, Sandeep Gangadharan -->
<!-- For more free scripts go to http://sivamdesign.com/scripts/ -->
<!--
function sivamtime() {
now=new Date();
hour=now.getHours();
var morning = "morning.mp3"; // change name of audio files here to suit your needs
var noon = "noon.mp3"; // you can have any type of audio files
var afternoon = "afternoon.mp3";
var evening = "evening.mp3";
var def = "default.mp3";
if (hour >= 7 && hour < 12) { document.write("<embed src='" + morning + "' hidden='true' border='0' autostart='true' loop='true'>") }
if (hour == 12) { document.write("<embed src='" + noon + "' hidden='true' border='0' autostart='true' loop='true'>") }
if (hour > 12 && hour < 17) { document.write("<embed src='" + afternoon + "' hidden='true' border='0' autostart='true' loop='true'>") }
if (hour >= 17 && hour < 22) { document.write("<embed src='" + evening + "' hidden='true' border='0' autostart='true' loop='true'>") }
else { document.write("<embed src='" + def + "' hidden='true' border='0' autostart='true' loop='true'>") }
}
sivamtime()
// -->
</script>
<script type="text/javascript">
// http://www.webdeveloper.com/forum/showthread.php?t=233628
/*
The Time Through Ages. In the Name of Allah, Most Gracious, Most Merciful. 1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
*/
function swapMusicAndImage() {
var d = new Date();
// alert(d)
var t = d.getTime();
// alert(t);
var times = [d.setHours(5, 30), d.setHours(12,15), d.setHours(15,15), d.setHours(19, 5), d.setHours(22, 10) ];
// alert(times[0]);
var songs = ["morning.mp3","noon.mp3", "afternoon.mp3", "evening.mp3", "night.mp3" ];
var image = ["morning.jpg","noon.jpg", "afternoon.jpg", "evening.jpg", "night.jpg" ];
var img = document.getElementById("myimages");
var el = document.getElementById("music");
if( t >= times[0] && t< times[1] ) { img.src=image[0]; el.src=songs[0]; }
if (t >= times[1] && t< times[2] ) { img.src=image[1]; el.src=songs[1]; }
if (t >= times[2] && t< times[3] ) { img.src=image[2]; el.src=songs[2]; }
if (t >= times[3] && t< times[4] ) { img.src=image[3]; el.src=songs[3]; }
if (t >= times[4] || t< times[0] ) { img.src=image[4]; el.src=songs[4]; }
alert(document.body.innerHTML);
}
// Multiple onload function written by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) { oldonload(); }
func();
}
}
}
addLoadEvent(function() { swapMusicAndImage(); });
</script>
</head>
<body>
<embed id="music" src="" hidden="true" border="0" autostart="true" loop="true"></embed>
<img id="myimages" src="" alt="my images" width="200" height="300">
How to open a dynamic page in IFRAME using JavaScript?
The Time Through Ages
In the Name of Allah, Most Gracious, Most Merciful
1. By the Time,
2. Verily Man is in loss,
3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
The Time Through Ages
In the Name of Allah, Most Gracious, Most Merciful
1. By the Time,
2. Verily Man is in loss,
3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
Bookmarks