10 lines
270 B
HTML
10 lines
270 B
HTML
<script>
|
|
function loadImage(src) {
|
|
return new Promise((resolve, reject) => {
|
|
let img = document.createElement('img');
|
|
img.src = src;
|
|
img.onload = () => resolve(img);
|
|
img.onerror = () => reject(new Error("Image load failed: " + src));
|
|
});
|
|
}
|
|
</script>
|