Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Need Help with this scripts please

  1. #1
    Join Date
    Dec 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Need Help with this scripts please

    Hello guy's, how are you?

    I'm really going to appreciate if you help me just a bit, k?

    I am looking for an image script that changing background image between hours;

    between 6AM to 6PM Pic number will be on the site background... and between 6PM to 6AM pic number 2 will be on the backgoround.

    I searched ALL OVER the internet and i didnt find this script yet.
    This script DO exist.... but i'm not a scripts builder....

    PLEASE PLEASE PLEASE I'M BEGGING YOU!
    Help me fund this script... PLEASE !

  2. #2
    Join Date
    Dec 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    6am - 6pm user time... or server time?

  3. #3
    Join Date
    Dec 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    User time. please.

  4. #4
    Join Date
    Dec 2005
    Location
    Moscow, Russia
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It is easier to write it, than to find
    On each page of a site you might write a code (or in <script src=code.js> </script>)
    Code:
    <script>A=[new Image(),new Image()];A[0].src='snow.gif';A[1].src='snow21.gif';  //'snow.gif' is from 6AM to 6PM
    onload=function(){
    	document.body.background=A[((D=new Date().getHours())<6||D>=18)+0].src;
    }
    </script>
    <body> ...

  5. #5
    Join Date
    Dec 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,

    First, i want to THX you very much for helping me and spending your time for me

    Now, i check it out and it works! OMG MAN THX SO MUCH!
    But if you mind, i need just alittle bit more of your good help.

    I need a script, the same as this Image changing by time script, but Music script! i want to do a script that play 2 different music between 6AM to 6PM and the opposite....

    I'm sure its gonna be a piece of cake for pro like you

    Btw, you dont jave to answer this, but i'm just asking, there is any way to make this image script you gave above, to change between 3 times a day? like feom 6AM to 12AM *Image1*. from 12AM to 8PM *Image2*. from 8PM to 6AM *Imahe3*...

    This is possible for images and music script?

    THX again for your good help
    Last edited by ADUN; 12-29-2005 at 05:20 PM.

  6. #6
    Join Date
    Dec 2005
    Location
    Moscow, Russia
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Certainly, script can manage everything both with pictures, and with music. For example, there is demo code where background varies each 3 seconds.

    But music has such feature, that it works not on all computers and not in all browsers. There can even be error messages which will prevent to look content. There are many ways to start music, but they differ even what player is established - MS mediaplayer or Apple QuickTime or other.

    I tried to start in different browsers such code:
    Code:
    <embed id=snd src=your_media_file.mp3 autostart=false height=42 loop=true controller=true hid den=true></embed><br> 
    <input type=button onClick=d.getElementById("snd").Play(); value=Play> 
    <input type=button onClick=d.getElementById("snd").Stop(); value=Stop> 
    <input type=button onClick=d.getElementById("snd").Rewind(); value=Rewind)>
    If it will work from the button with the help of the code specified in tag of the button, it is possible to start one or other melody (from other embed tag). They may be invisible if write "hidden=true". (But will play in IE only.)

    Here is script with optimization - it won't be preload all images, but only one according to time of day:
    Code:
    <script>D=new Date().getHours();
    A=new Image();
    onload=function(){
    	if(D>=6&&D<12){A.src='snow1.gif';document.body.background=A.src;}	//bg 6-12AM
    	if(D>=12&&D<20){A.src='snow2.gif';document.body.background=A.src;}	//bg from 12AM to 8PM
    	if(D>=20||D<6){A.src='snow3.gif';document.body.background=A.src;}	//bg from 8PM to 6AM
    	
    	if(D<6||D>=20)setTimeout('document.getElementById("snd2").Play();',1999);	//snd 20-6
    	if(D>=6&&D<20)setTimeout('document.getElementById("snd1").Play();',1999);	//snd 6-20; timeshift needed for opening of plugin
    }
    </script>
    <body><embed id=snd1 src=snd1.mp3 autostart=false  height=1 width=1 loop=true controller=false></embed>
    <embed id=snd2 src=snd2.wav autostart=false height=1 width=1 loop=true controller=false></embed>
    <input type=button onClick=document.getElementById("snd1").Stop();document.getElementById("snd2").Stop(); value=Stop_Music>
    (I cannot speak reliably without the checked up example, therefore it's present )
    Last edited by 12345c; 12-29-2005 at 08:22 PM.

  7. #7
    Join Date
    Dec 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok man,

    Its amazing how you can play with this image script... you GOOD...!
    Lets put the music script a side for now...

    Can you tell me how to chagne hours and add/remove more images in the script please?

    (Thx )

  8. #8
    Join Date
    Dec 2005
    Location
    Moscow, Russia
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Don't mention it
    > to chagne hours and add/remove more images
    it's simply.
    "D" contain a hour (0-23). You write logical expression with "D": D>=6&&D<12
    or
    D>=20||D<6 .
    Desirable picture is put instead of this: A.src='snow1.gif';

  9. #9
    Join Date
    Dec 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Damn man you really good, it really work!
    This is the new script:


    <script>D=new Date().getHours();
    A=new Image();
    onload=function(){

    if(D>=6&&D<12){A.src='Pic.JPG';document.body.background=A.src;} //bg 6AM-12AM
    if(D>=12&&D<15){A.src='Pic.JPG';document.body.background=A.src;} //bg from 12AM to 3PM
    if(D>=15&&D<18){A.src='Pic.JPG';document.body.background=A.src;} //bg from 3PM to 6PM
    if(D>=16&&D<20){A.src='Pic4.JPG';document.body.background=A.src;} //bg from 6PM to 8PM
    if(D>=20||D<6){A.src='Pic.JPG';document.body.background=A.src;} //bg from 8PM to 6AM

    if(D<6||D>=20)setTimeout('document.getElementById("snd2").Play();',1999); //snd 20-6
    if(D>=6&&D<20)setTimeout('document.getElementById("snd1").Play();',1999); //snd 6-20; timeshift needed for opening of plugin
    }
    </script>

    Pic
    Is this allright?

    Next and last thing. before the final Thx..
    I want the same changing script, but for MP3... i want to make this coolo effect of birds at day time and cricket at night...

    is this possible?
    [/QUOTE]

  10. #10
    Join Date
    Dec 2005
    Location
    Moscow, Russia
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thx, thin flatteral praise
    > I want the same changing script, but for MP3
    Strings
    if(D<6||D>=20)setTimeout('document.getElementById("snd2").Play();',1999); //snd 20-6
    if(D>=6&&D<20)setTimeout('document. ....

    are for sound, but you should add 2 lines below tag <body>:
    Code:
    	if(D<6||D>=20)setTimeout('document.getElementById("snd2").Play();',1999);	//snd 20-6
    	if(D>=6&&D<20)setTimeout('document.getElementById("snd1").Play();',1999);	//snd 6-20; timeshift needed for opening of plugin
    }
    </script>
    <body>
    
    ...
    
    <embed id=snd1 src=__birds__.mp3 autostart=false  height=1 width=1 loop=true controller=false></embed>
    <embed id=snd2 src=__cricket__.mp3 autostart=false height=1 width=1 loop=true controller=false></embed>
    <input type=button onClick=document.getElementById("snd1").Stop();document.getElementById("snd2").Stop(); value=Stop_Music>
    Button is necessary for stopping.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •