0

HTML

<audio controls id="controls">
    <source src="Song.mp3" type="audio/mpeg">
</audio>

JavaScript

var FileName = document.getElementById("controls").src

alert(FileName) 我正在尝试让警报框说出源名称(Song.mp3),但不确定如何提供帮助!

4

2 回答 2

0
var FileName = $("source").attr('src');
于 2013-10-08T10:42:33.937 回答
0

做:

var FileName = document.getElementById("controls").getElementsByTagName("source")[0].src;
于 2013-10-08T10:43:28.333 回答