ITeye博客

js 页面简易音乐播放器

=寂寞_狐狸= · 2012-01-04 14:06 · javascript · Web前端 · Markdown

<!doctype html>

<head>
  <meta charset="utf-8" />
  <title>HTML5 Document</title>
  <script>
function playClicked(element)
{
//get the state of the player
if(audio_player.paused)
{
audio_player.play();
newdisplay = "| |";
}else{
audio_player.pause();
newdisplay = ">";
}
element.value=newdisplay;
}
</script>
</head>
<body>
<audio controls="controls" id="audio_player">
 <source src="alert.wav" >
</audio>
<input type="button" onclick="playClicked(this)" value=">">
</body>
</html>

 

 

chrome 能用!!!亲测!

 

还有一个,也是能用的,取自w3协议社区

<embed type="audio/mpeg" src="Kalimba.mp3" style="width:400px; height:100px; border:3px solid black;" />

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。