Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: reminder alarm

  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    reminder alarm

    Need help for an alarm to remind an event with sound

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by dips255 View Post
    Need help for an alarm to remind an event with sound
    Too vague (and too curt). How about "please"? I note you have 51 posts - but 0 thanks. But this ought to point you in the right direction. Sound is a big problem in HTML4 and the method used here is really only useful in IE and Firefox. The HTML5 <audio> tag is to be preferred but is only supported by the most modern browsers.


    Code:
    <span id ="message" style = "color:red";> </span>
    
    <script type = "text/javascript">
    
    var today = new Date();
    var BigDay = new Date("July 20, 2012 17:00:00 UTC");  
    timeInSecs = parseInt((BigDay.getTime() - today.getTime())/1000);
    if (timeInSecs <= 0 && timeInSecs >= -3600) {  // show the message between chosen time and one hour afterwards
    document.getElementById("message").innerHTML = "The time you wish to be reminded about has arrived";
    self.location = "boom.wav";  // your sound file. This may pop up a separate window depending on plugins installed. 
    }
    
    </script>
    For IE ONLY you could place the following tag after the message <span>
    <bgsound id="bgsound_id" loop=1 src="">
    and in the script
    document.all['bgsound_id'].src='boom.wav';


    A man generally has two reasons for doing things - the one that sounds good, and the real one. - J.P.Morgan
    Last edited by Philip M; 07-20-2012 at 08:07 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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