当前位置:网站首页>Laravel admin uses native JS to realize sound prompt and automatic playback
Laravel admin uses native JS to realize sound prompt and automatic playback
2022-06-26 11:06:00 【siner. li】
This content is on laravel-admin HomeController.php Internally written
html part
<h3><span class='label' id="onejs">$data[0]
<audio id="sound" autoplay="autoplay"></audio>
</span></h3>
JS part
<script >
var onejs = document.getElementById('onejs');
var sound = document.getElementById("sound");
setInterval(function () {
// '/' Followed by the request path , data For request parameters
$.get("/",function(data){
if ((data > 0) && (onejs.innerHTML < data)){
sound.src="/tip.mp3";
}
onejs.innerHTML = data;
});
},5000);
</script>
Auto play audio
There must be page interaction , For Google browser
html part
<span class='label' id="onejs">$data[0]
<audio id="sound" muted autoplay src="/tip.mp3"></audio>
</span>
js part
var onejs = document.getElementById('onejs');
var sound = document.getElementById("sound");
setInterval(function () {
$.get("/help",function(data){
if ((data > 0) && (onejs.innerHTML < data)){
sound.muted=false
sound.play()
}
onejs.innerHTML = data;
});
},5000);
边栏推荐
- sliding window
- laravel 安装报错 Uncaught ReflectionException: Class view does not exist
- 2、 Linear table
- Postman入门教程
- laravel-admin隐藏按钮, 及设置按钮显示, 默认序列, form 表单的不可修改值
- Expand and collapse too high div
- Grain Mall - distributed Foundation
- Query online users and forced withdrawal users based on oauth2
- 24 个必须掌握的数据库面试问题!
- Redis (basic) - learning notes
猜你喜欢

Detailed explanation of MySQL fuzzy query

Win10 start FTP service and set login authentication

携程机票 App KMM 跨端 KV 存储库 MMKV-Kotlin | 开源

nacos2.x.x启动报错信息Error creating bean with name ‘grpcClusterServer‘;
![[echart] II. User manual and configuration item reading notes](/img/03/fa87e5b8f8d23381ea6923d507f250.jpg)
[echart] II. User manual and configuration item reading notes

ACK攻击是什么意思?ACK攻击怎么防御?

loggie 编码以及换行符测试

sliding window

Nacos2.x.x start error creating bean with name 'grpcclusterserver';

Easyexcel - Excel read / write tool
随机推荐
How does unity prevent other camera positions and rotations from being controlled by steamvrplugin when using steamvrplugin
互联网对抗神器之漏洞扫描与反渗透
sliding window
April 13, 2021 interview with beaver family
[deep learning theory] (6) recurrent neural network RNN
Plookup table in appliedzkp zkevm (8)
JS take the date of the previous month 【 pit filling 】
mysql性能监控和sql语句
一键部署属于自己的社区论坛
laravel-admin 用 原生JS实现声音提示,及自动播放
机器学习深度神经网络——实验报告
02 linked list of redis data structure
matlab 编程实例: 如何统计元胞数组中元素的数量
UDP flood attack defense principle
ACK攻击是什么意思?ACK攻击怎么防御?
Code specification & explain in detail the functions and uses of husky, prettier, eslint and lint staged
Moore vote, leetcode169, leetcode229
loggie 编码以及换行符测试
SVN 安装配置
jwt认证协议阐述之——我开了一家怡红院