网站在这里http://thomaspalumbo.com/tests/
代码:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.jplayer.min.js"></script>
<script type="text/javascript">
function playSound() {
var sounds = new Array(
"bells.mp3"
);
$('#soundDiv').html("<embed src=\""+sounds[Math.floor(Math.random()* (sounds.length+1))]+"\" hidden=\"true\" autostart=\"true\" />");
return false;
};
</script>
</head>
<body>
<button onclick="javascript:playSound()">Button</button>
<div id="soundDiv"></div>
有什么帮助吗?当我单击按钮并且声音仍在播放时,我通常会收到此错误。此外,如果不重新加载页面,我也无法获得执行该功能的按钮。换句话说,我不希望页面重新加载。