62,046
社区成员
发帖
与我相关
我的任务
分享
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