你在测试的时候可以先清空IE缓存,然后执行代码,再查看缓存。
代码如下:
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<bgsound volume='-5000' id='bgsound1' loop='1' src="http://localhost:8088/bpelDemo/aaa.mp3">
<bgsound volume='-5000' id='bgsound2' loop='1' src="http://localhost:8088/bpelDemo/bbb.mp3">
<bgsound volume='-5000' id='bgsound3' loop='1' src="http://localhost:8088/bpelDemo/ccc.mp3">
<bgsound volume='-5000' id='bgsound4' loop='1' src="http://localhost:8088/bpelDemo/ddd.mp3">
</HEAD>
<BODY>
<script>
function window.onload(){
var bgSoundObj = document.getElementById("bgsound1")
bgSoundObj.src=""
bgSoundObj.volume=1
//删除多余的bgsound对象
var bgSoundObjs = document.getElementsByTagName("bgsound")
for(var i=1i<bgSoundObjs.lengthi++){
bgSoundObjs[i].removeNode()
}
alert("目前所有音乐加载完成,可以去IE缓存查看加载MP3文件")
}
</script>
声音已经加载,播放无需重新加载<p>
<input type='button' onclick='document.getElementById("bgsound1").src="http://localhost:8088/bpelDemo/aaa.mp3"' value="music1">
<input type='button' onclick='document.getElementById("bgsound1").src="http://localhost:8088/bpelDemo/bbb.mp3"' value="music2">
<input type='button' onclick='document.getElementById("bgsound1").src="http://localhost:8088/bpelDemo/ccc.mp3"' value="music3">
<input type='button' onclick='document.getElementById("bgsound1").src="http://localhost:8088/bpelDemo/ddd.mp3"' value="music4">
</script>
</BODY>
</HTML>
可以用<bgsound>标签。<html>
<head>
<script>
function init(){
if(判断条件有消息){
document.getElementById("sound").src="sound.wav"
或者document.all.sound.src="sound.wav"
或者document.getElementsByName("*").sound.src="sound.wav"
}
}
</script>
</head>
<body>
<bgsound id="sound">
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)