js 调用声音提示

function playSound()
{
var borswer = window.navigator.userAgent.toLowerCase();
if ( !!window.ActiveXObject || "ActiveXObject" in window )
{
//IE内核浏览器
var OSPlayer = new ActiveXObject("WMPLayer.OCX");
OSPlayer.url = "http://www.xmf119.cn/static/admin/sounds/notify.wav";
OSPlayer.controls.play();
} else
{
//非IE内核浏览器
var strAudio = "
if ( $( "body" ).find( "audio" ).length <= 0 )
$( "body" ).append( strAudio );
var audio = document.getElementById( "audioPlay" );

//浏览器支持 audion
audio.play();
}
}

转载于:https://www.cnblogs.com/wayne173/p/9661439.html

你可能感兴趣的:(js 调用声音提示)