any one knows what is wrong this code before i go crazy, i have tryed it, but no luck(i need help pls) and yes i have changed the times. HTML: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> <title>New Page 1</title> </head> <body> <embed src="http://www.hypergurl.com/games/soundfiles/the_time_is.wav" hidden="true" autostart="false" name="soundfile1"> <script language="JavaScript"> day = new Date() hr = day.getHours() if (hr==1) {document.soundfile1.play()} </script> </body> </html>
Your script is only executing once; when the page loads. When 1:00 arrives the page isn't testing the time anymore. I'd use Code: <script language="JavaScript"> function timer { day = new Date() hr = day.getHours() if (hr==1) {document.soundfile1.play()} setTimeout ('timer()', 1000); </script> This function will call itself second (1000 miliseconds) and check the time again. To start the process add this to your body element <body onload='timer()'> ... </body>