HTML DOM Audio src attribute
Examples
Get URL of the audio file:
var x = document.getElementById("myAudio").src;
x The output is:
http://www.w3cschool.cc/try/demo_source/horse.ogg
try it"
Definition and Usage
src property sets or returns the current audio source.
src attribute specifies the location of the audio file (URL).
Browser Support
All major browsers support the src attribute. But not all major browsers support the definition of audio file formats.
Note: Internet Explorer 8 and earlier versions of IE do not support the <audio> element.
grammar
Back src attribute:
audioObject .src
Setting the src attribute:
audioObject .src= URL
Property Value
值 | 描述 |
---|---|
URL |
规定音频来源的 URL。 可能的值:
|
technical details
return value: | String representing the URL of the audio file. Back entity URL, including the protocol (such as http: //) |
---|
Related Pages
HTML Reference Manual: HTML <Audio> the src attribute.
Audio Object