日期:2014-05-16 浏览次数:20404 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<audio controls="controls" autoplay="autoplay">
<source src="E:\01.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
</BODY>
</HTML>
<script>
function play(url){//url为mp3文件路径
//这里要怎么写呢?才能让我调用这个函数时,立即播放MP3?
}
</script>
<script type="text/javascript">
function play(url) {
var a = document.getElementById('audio');
a.src = url;
a.play();
}
</script>
<input type="button" value="Play" onclick="play('http://www.coding123.net/eg/showbo/music/暗夜精灵.MP3')" />
<audio controls="controls" autoplay="autoplay" id="audio">
Your browser does not support the audio tag.
</audio>
<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<!--
<audio controls="controls" autoplay="autoplay">
<source src="E:\01.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>
-->
<script>
function play(url){
alert(url);
var audio = document.createElement('audio');
var source = document.createElement('source');
source.type = "audio/mpeg";
source.type = "audio/mpeg";