它建议私用html5的 Audio 标签Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the <audio> element.<audio controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>参考: http://www.w3schools.com/html/html5_audio.asp
if (soundObject != null) { document.body.removeChild(soundObject);
soundObject = null; } soundObject = document.createElement("bgsound"); soundObject.setAttribute("src", "C:/sound1.wav"); soundObject.setAttribute("hidden", true); soundObject.setAttribute("autostart", true); document.body.appendChild(soundObject);
} function StopSound()
{
if (soundObject != null) { soundObject.setAttribute("src", "");
soundObject = null; }
} </script></head><body> <form id="form1" runat="server"> <input type = "button" onclick = "PlaySound()" value = "Play Sound" /> </form></body></html>
代码来自:
http://stackoverflow.com/questions/15909172/how-to-play-pause-a-wav-file-in-asp-page
No, really. Don't use it.
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>参考:
http://www.w3schools.com/html/html5_audio.asp