Source src 属性
定义和用法
src 属性设置或返回 <source> 元素中 src 属性的值。
src 属性指定要播放的媒体文件的 URL。
注释: Internet Explorer 8 及更早版本,仅返回文件名(例如 horse.mp3),而不是 URL (https://www.cainiaomax.com/jsref/horse. mp3)。
浏览器支持
| 属性 | |||||
|---|---|---|---|---|---|
| src | Yes | Yes | Yes | Yes | Yes |
语法
返回 src 属性:
sourceObject.src
设置 src 属性:
sourceObject.src = URL
属性值
| 值 | 描述 |
|---|---|
| URL | 指定媒体文件的 URL。 可能值:
|
技术细节
| 返回值: | 字符串, representing the URL of the media file. Returns the entire URL, including the protocol (like http://) |
|---|
相关页面
HTML 参考手册: HTML <source> src 属性
❮ Source 对象

