码迷,mamicode.com
首页 > 其他好文 > 详细

兼容chrome和ie的音乐播放

时间:2014-10-20 17:23:13      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   java   strong   sp   2014   on   

兼容chrome和ie的音乐播放(Ie7 Ie8 Ie9 均测试过 )

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>aa</title>


<script> 
function playSound(){ 
	var snd_ie = document.getElementById('snd_ie'); 
	snd_ie.src = "./alert.wav"


	var snd_chrome = document.getElementById('snd_chrome'); 
	snd_chrome.data = "./alert.wav"
} 
function stopSound(){ 
	var snd_ie = document.getElementById('snd_ie'); 
	snd_ie.src = ""


	var snd_chrome = document.getElementById('snd_chrome'); 
	snd_chrome.data = ""
} 


</script> 


</head>
<body>
	<bgsound id='snd_ie' src="" loop=-1></loop>
	<object id='snd_chrome' width="0px" height="0px" type="audio/x-wav" data=""></object>
	<input type="button" value="开始" onclick="playSound()"> 
	<input type="button" value="暂停" onclick="stopSound()"> 
</body>
</html>






兼容chrome和ie的音乐播放

标签:blog   http   io   ar   java   strong   sp   2014   on   

原文地址:http://blog.csdn.net/metecyu/article/details/40301709

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!