HTML DOM attribut Image src
Définition et utilisation
ensembles de propriétés src ou retourne la valeur de l'attribut src image.
attribut src spécifie l'URL d'un graphique.
grammaire
imageObject.src=URL
support du navigateur
Tous les principaux navigateurs prennent en charge l'attribut src
Exemples
Exemples
<html>
<head>
<script>
function changeSrc()
{
document.getElementById("myImage").src="hackanm.gif";
}
</script>
</head>
<body>
<img id="myImage" src="compman.gif" width="107" height="98">
<br><br>
<input type="button" onclick="changeSrc()" value="Change image">
</body>
</html>
<head>
<script>
function changeSrc()
{
document.getElementById("myImage").src="hackanm.gif";
}
</script>
</head>
<body>
<img id="myImage" src="compman.gif" width="107" height="98">
<br><br>
<input type="button" onclick="changeSrc()" value="Change image">
</body>
</html>
Essayez »
objet image