Home > Backend Development > PHP Tutorial > 请教能否在网页中播放警报声

请教能否在网页中播放警报声

WBOY
Release: 2016-06-13 10:47:01
Original
1266 people have browsed it

请问能否在网页中播放警报声?
比如我添加了一个变量$AlarmThreshold,当它超过某个阈值时自动播放该声音?这样怎么弄好呢?是不是要添加一个flash之类的呢?求方法。

------解决方案--------------------
php不能说话的。。要用flash或html的媒体标签
------解决方案--------------------
那你总得也要跟前端交互才行啊。

最终还是要js去触发
------解决方案--------------------
这要用js控制,可以用PHP在页面放一个判断值,用js获取其中的value,然后再输出报警声:

JScript code
<script><?php    if(!empty($alarmList)){ ?>                //这里的src指向声音文件        $("#music").html('<embed id = "soundControl1"  src = "./style/baojing.mp3"  mastersound hidden = "true"  loop ="true"  autostart = "true">');    <?php }else{ ?>        $("#music").html("");?></script><div id="music"></div><div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template