Use the onload
event which fires when image has been loaded like this:
object.onload = function(){
// image has been loaded
};
Also have a look at:
Update:
To run code unless image has not been loaded, you could do this way:
<script language="javascript">
object = new Image();
// here image is not loaded yet
object.onload = function(){
// image has been loaded
};
// image loaded, show it
object.src = '$imageurl';
</script>
I suspect you are using php by seeing $imageurl
, you need to replace the line:
object.src = '$imageurl';
With:
object.src = '<?php echo $imageurl;?>';