HTML DOM atributo src Imagen
Definición y Uso
src conjuntos de propiedades o devuelve el valor del atributo src imagen.
atributo src especifica el URL de una gráfica.
gramática
imageObject.src=URL
Soporte para el navegador
Todos los principales navegadores soportan el atributo src
Ejemplos
Ejemplos
<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>
Trate »
objeto de imagen