# innerHTML return image

**URL:** <https://forum.kirupa.com/t/innerhtml-return-image/260455>\
**Category:** web dev\
**Created:** [May 15, 2008, 7:29pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455 "2008-05-15T19:29:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)\
**Post date:** [May 15, 2008, 7:29pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/1 "2008-05-15T19:29:06Z")

</div>

```auto
 
<script>
function startloading(){
document.getElementById("java").innerHTML="<img src=\"..images/ajax-loading.gif\"/><br />Please wait while your video uploads.";
}
</script>

```

When a button is clicked, the text appears 100% correct, but the image is not returning. Yes, the image is in the correct place, but not loading for some reason when the button is clicked.

Anyone know why?

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 15, 2008, 7:47pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/2 "2008-05-15T19:47:38Z")

</div>

```auto

..images/ajax-loading.gif

```

should probably be

```auto

images/ajax-loading.gif

```

---

<div class="post-metadata">

**Author:** ![fasterthanlight](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fasterthanlight](https://forum.kirupa.com/u/fasterthanlight)\
**Post date:** [May 15, 2008, 8:04pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/3 "2008-05-15T20:04:39Z")

</div>

or

```auto

../images/ajax-loading.gif

```

---

<div class="post-metadata">

**Author:** ![Syous](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@Syous](https://forum.kirupa.com/u/Syous)\
**Post date:** [May 15, 2008, 8:19pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/4 "2008-05-15T20:19:08Z")

</div>

Ya done both, no dice. I just made the div’s background image the .gif since the div doesn’t show til the button is clicked and it is working, lol.

---

<div class="post-metadata">

**Author:** ![kdd](https://avatars.discourse-cdn.com/v4/letter/k/ecb155/32.png) [@kdd](https://forum.kirupa.com/u/kdd)\
**Post date:** [May 15, 2008, 9:12pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/5 "2008-05-15T21:12:02Z")

</div>

Does the image really exist? Try giving an absolute path and see what happens…

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 15, 2008, 9:45pm UTC](https://forum.kirupa.com/t/innerhtml-return-image/260455/6 "2008-05-15T21:45:31Z")

</div>

Well I can definitely tell you it’s a pathing issue, there’s no other reason for it not to work. If you have firebug you should be able to see it trying to call it from that path that it thinks it should be calling it from.
