HTMLSourceElement: src-Eigenschaft
Die src
-Eigenschaft des HTMLSourceElement
-Interfaces ist ein String, der die URL einer Mediendatei angibt, die als Quelle für das Element verwendet werden soll.
Sie spiegelt das src
-Attribut des <source>
-Elements wider, das in einem <audio>
- oder <video>
-Element eingebettet ist. Es hat keine Bedeutung und wird ignoriert, wenn es in einem <picture>
-Element eingebettet ist.
Wert
Ein String; die URL einer Quellenressource, die im Element verwendet werden soll.
Beispiele
html
<source
id="el"
src="large.webp"
type="video/webp"
media="screen and (600px <= width <= 800px)" />
js
const el = document.getElementById("el");
console.log(el.src); // Output: "large.webp"
el.src = "medium.webp"; // Updates the src value
Spezifikationen
Specification |
---|
HTML # dom-source-src |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
src |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.