HTML Audio/Video DOMsrcProperties

HTML audio/video 标签参考手册HTML Audio/Video DOM Reference Manual

Examples

Change the source of the video:

myVid=document.getElementById("video1");
myVid.src="movie.ogg.html";

Try it Yourself »

Definition and Usage

The src property sets or returns the current source of the audio/video.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, Opera, Chrome, and Safari support the src property.

Note:Internet Explorer 9 and earlier versions do not support the src property.


Syntax

Set the src property:

audio|video.src=URL

Return the src property:

audio|video.src

Property Values

Value Description
URL Specifies the URL of the audio/video source.

Possible values:

  • Absolute URL - points to another website (such as src="http://www.example.com/movie.ogg")
  • Relative URL - points to a file within the website (such as src="movie.ogg")

Technical Details

Return value: A string value, the current audio/video source.


HTML audio/video 标签参考手册HTML Audio/Video DOM Reference Manual Other Extensions