Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts

    displaying image

    Am i even close here lol i so suck at javascript lol

    Code:
     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 =
    Last edited by durangod; 11-06-2012 at 10:48 PM.

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    52
    Thanks
    0
    Thanked 9 Times in 9 Posts
    If you create an img element, then you need to append it to a parent element
    Code:
     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?

  • Users who have thanked Calvert Tripesi for this post:

    durangod (11-06-2012)

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,341
    Thanks
    260
    Thanked 32 Times in 31 Posts
    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

    Code:
    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

    Code:
    <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
    Attached Images Attached Images  
    Last edited by durangod; 11-06-2012 at 06:59 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •