如何在PHP中每隔30分钟创建一次警报

时间:2017-12-15 03:40:04

标签: javascript

如何在PHP中每30分钟创建一次闹钟?

<script type="text/javascript">
 function closeWindow() {
    setTimeout(function() {
    window.close();
    }, 1800000);
    }

    window.onload = closeWindow();
    </script>
</head>
<body>
<audio controls autoplay="autoplay">

<source src="apple_ring.mp3" type="audio/mpeg">

1 个答案:

答案 0 :(得分:1)

删除所有关闭窗口,然后尝试此操作。

<audio id="alarmAudio" controls autoplay="autoplay">
    <source src="apple_ring.mp3" type="audio/mpeg">
</audio>

<script> 
    var alarm = document.getElementById("alarmAudio");

    setInterval(function(){
        alarm.play(); 
    }, 1800000);        
</script>