...

View Full Version : Resolved displaying image



durangod
11-06-2012, 07:13 PM
Am i even close here lol i so suck at javascript lol




var img = document.createElement('img');
img.src = "/images/loader.gif";
img.width = 32;
img.height = 32;

document.getElementById("showimage").value="img";




and of course the above is not working lol I think the prob is in my value =

Calvert Tripesi
11-06-2012, 07:30 PM
If you create an img element, then you need to append it to a parent element



var img = document.createElement('img');
img.src = "/images/loader.gif";
img.width = 32;
img.height = 32;

document.body.appendChild( img );
Is that what you're trying to do?

durangod
11-06-2012, 07:56 PM
im trying to add an image to a hidden div


i cant just put the img src = because its a gif and it shows the image but it does not display the motion of the gif image just the still image so i thought if i added it to the js it would show the motion

so can i do this




function showhdiv()
{
var fval = document.FrmPicture.fileupload.value;

if (fval)
{
var img = document.createElement('img');
img.src = "/images/loader.gif";
img.width = 32;
img.height = 32;

document.getElementById("vidstatus").style.display = "inline";
document.body.appendChild( img );

}

}//close function showhdiv



what i want is for the inline text to show, and then the gif image after that

the problem again is that if i do this outside the div


<img src="/images/loader.gif" border="0" alt="" />

the motion gif shows fine, but inside the div it just shows the still image (no motion) and i dont know why.

I have attached the loader.gif image for you to see



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum