0
点赞
收藏
分享

微信扫一扫

手机网页震动语音提醒;闹钟

捌柒陆壹 2022-03-30 阅读 51
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title></title>
    </head>
    
    <body> 
         <script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
 
<audio src="https://www.cbdaojia.com//yuyin/语音1 .mp3"   id="music2"></audio>
 
      <script type="text/javascript" >
      /*
      番茄工作法(工作时间(60分钟)、休息时间(5分钟))
喝水提醒(时间区间:08:00~23:00,间隔时间:60分钟)
服药提醒 
自定义提醒
备注日历名称
城市选择

      
      */
  
      
         function vibration() {
      navigator.vibrate = navigator.vibrate
        || navigator.webkitVibrate
        || navigator.mozVibrate
        || navigator.msVibrate;

      if (navigator.vibrate) {
        // 支持
        console.log("支持设备震动!");
      }

  
                      
                  
    }
    vibration();
                 
     var times=[
          "14:40"
          ];
   	var d = new Date();
		var h='';
		var i='';
			if( d.getHours()<10){
			h="0"+d.getHours()
		}else{ 
			h= d.getHours() 
		}
		if( d.getMinutes()<10){
			i="0"+d.getMinutes()
		}else{ 
			i= d.getMinutes() 
		}
 
  
  setInterval(alertFunc, 10000);
 	
function alertFunc() {
	times.forEach((item,index,array)=>{
		var d = new Date();
		var h='';
		var i='';
		if( d.getHours()<10){
			h="0"+d.getHours()
		}else{ 
			h= d.getHours() 
		}
		if( d.getMinutes()<10){
			i="0"+d.getMinutes()
		}else{ 
			i= d.getMinutes() 
		}
		if(item==h+":"+ i){
               navigator.vibrate([500, 300, 400, 300]);
                  var music = document.getElementById("music2");
                 music.play();
               alert(1);
		} 
		 console.log(item); 
//		 if(){}
    //执行代码
})
// console.log(times); 
}

  

 
  

  
    </script>
    <script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script>
<script>
  // init vConsole
  var vConsole = new VConsole();
  console.log('Hello world');
</script>
 

    </body>
</html>
举报

相关推荐

0 条评论