1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > JS播放声音 兼容所有浏览器

JS播放声音 兼容所有浏览器

时间:2022-06-11 11:06:50

相关推荐

JS播放声音 兼容所有浏览器

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "/DTD/xhtml-mobile10.dtd"> <html xmlns="/1999/xhtml"><head><title>JS播放声音 兼容所有浏览器</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="author" content="龚清林 - " /><script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script></head><body><script language="javascript">playSound();function playSound(){var borswer = window.navigator.userAgent.toLowerCase();if ( borswer.indexOf( "ie" ) >= 0 ){//IE内核浏览器var strEmbed = '<embed name="embedPlay" src="/accessory/ding.wav" autostart="true" hidden="true" loop="false"></embed>';if ( $( "body" ).find( "embed" ).length <= 0 )$( "body" ).append( strEmbed );var embed = document.embedPlay;//浏览器不支持 audion,则使用 embed 播放embed.volume = 100;//embed.play();这个不需要} else{//非IE内核浏览器var strAudio = "<audio id='audioPlay' src='/accessory/ding.wav' hidden='true'>";if ( $( "body" ).find( "audio" ).length <= 0 )$( "body" ).append( strAudio );var audio = document.getElementById( "audioPlay" );//浏览器支持 audionaudio.play();}}</script></body></html>

/10/13通知:

域名已过期,没再续费。要声音文件可以去百度云盘下载,下载地址:/s/1hsw6xJQ 声音文件提示:“您有新的消息,请注意查收!”

/11/1通告:

兼容所有浏览器(吹的,还是有兼容问题)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。