zoukankan      html  css  js  c++  java
  • web 音频文件自动播放(兼容所有浏览器)

    function AudioPerform() {
                var ua = navigator.userAgent.toLowerCase();
                var audiopath = "$!{TempletPath}images/ring.wav";
                if (ua.match(/msie ([d.]+)/)) {
                    jQuery('#alert_sound').html('<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><param name="AutoStart" value="1" /><param name="Src" value="' + audiopath + '" /></object>');
                }
                else if (ua.match(/firefox/([d.]+)/)) {
                    //            jQuery('#alert_sound').html('<embed src="' + audiopath + '" type="audio/wav" hidden="true" loop="false" mastersound></embed>');
                    jQuery('#alert_sound').html('<audio autoplay="autoplay"><source src="' + audiopath + '" type="audio/wav"/><source src="$!{TempletPath}images/ring.wav" type="audio/mpeg"/></audio>');
                }
                else if (ua.match(/chrome/([d.]+)/)) {
                    jQuery('#alert_sound').html('<audio src="' + audiopath + '" type="audio/wav" autoplay=”autoplay” hidden="true"></audio>');
                }
                else if (ua.match(/opera.([d.]+)/)) {
                    jQuery('#alert_sound').html('<embed src="' + audiopath + '" hidden="true" loop="false"><noembed><bgsounds src=' + audiopath + '></noembed>');
                }
                else if (ua.match(/version/([d.]+).*safari/)) {
                    jQuery('#alert_sound').html('<audio src="' + audiopath + '" type="audio/wav" autoplay=”autoplay” hidden="true"></audio>');
                }
                else {
                    jQuery('#alert_sound').html('<embed src="' + audiopath + '" type="audio/wav" hidden="true" loop="false" mastersound></embed>');
                }
            }
  • 相关阅读:
    数据库从别的数据库查询一张表在插入到新的数据库里面
    html5 学习随笔 1
    .net MVC 学习笔记 (一)
    Html5 本地存储
    .net MVC 学习笔记 (二)
    蝙蝠侠解救罗宾的问题
    求职的第一面Harman
    求职第七面——烽火通讯
    求职的第二面—Samsung
    求职第六面——瑞星微电子
  • 原文地址:https://www.cnblogs.com/f-zp/p/4497213.html
Copyright © 2011-2022 走看看