这是链接 http://breakingbadbutton.com/
基本上你按下了按钮并播放了一个音频文件。我无法弄清楚为什么它在iPhone / iPad上不起作用......
剧本:
<script type="text/javascript">
$(document).ready(function() {
var sounds = [
"audio/basement.mp3",
"audio/half.mp3",
"audio/science.mp3",
"audio/tone.mp3",
"audio/minerals.mp3",
"audio/sticks.mp3",
"audio/gatorade.mp3",
"audio/roll.mp3",
"audio/right.mp3",
"audio/knocks.mp3",
"audio/hotdogs.mp3",
"audio/keys.mp3",
"audio/heil.mp3",
"audio/money.mp3",
"audio/ours.mp3",
"audio/pass.mp3"],
pickSound = 0;
$("button").click(function() {
$('#soundDiv').html("<embed src=\""+ sounds[pickSound] +"\" hidden=\"true\" autostart=\"true\" />");
pickSound = (pickSound + 1) % sounds.length;
});
});
答案 0 :(得分:0)
你应该使用更新的东西,我相信在HTML4.01中已弃用<embed>
相反,请使用<audio>
标记进行此类操作。Example here
您可以添加autoplay
等属性,它们都是available here
这是播放器改变mp3的小提琴,虽然mp3不可用,所以他们显然不会在这里玩:-) http://jsfiddle.net/mP3zM/