Image completePropiedad
Objeto Image
Definición y uso
La propiedad complete devuelve si el navegador ha terminado de cargar la imagen.
Si la carga se ha completado, devuelve true; de lo contrario, devuelve false.
Sintaxis
imageObject.complete
Compatibilidad del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad complete.
Ejemplo
Ejemplo
El siguiente ejemplo detecta si la imagen ha terminado de cargarse:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de novatos (example.com)</title>
<script>
function alertComplete(){
alert("Imagen cargada: " + document.getElementById("compman").complete);
}
</script>
</head>
<body onload="alertComplete()">
<img id="compman" src="compman.gif.html" alt="Computerman" width="107" height="98">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Tutorial de novatos (example.com)</title>
<script>
function alertComplete(){
alert("Imagen cargada: " + document.getElementById("compman").complete);
}
</script>
</head>
<body onload="alertComplete()">
<img id="compman" src="compman.gif.html" alt="Computerman" width="107" height="98">
</body>
</html>
Pruébalo »
Objeto Image Otras extensiones