<!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" >
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);
})
}
</script>
<script src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script>
<script>
var vConsole = new VConsole();
console.log('Hello world');
</script>
</body>
</html>
|