replace img at runtime w/ different size


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: replace img at runtime w/ different size

  1. #1
    Andrew Guest

    replace img at runtime w/ different size


    I have a photo gallery, and I'm using

    doc.img.src = 'newimage';

    To replace an image already on the screen. This works fine only when the
    new image is the same height/width as the old. Otherwise, IE resizes it.
    Is there any way to load an image of a different size without resizing?




    Andy

  2. #2
    Tom Duffy Guest

    Re: replace img at runtime w/ different size


    Hello Andrew:

    This looks like a JavaScript question and doesn't really belong here. Here's
    a possible solution anyway:

    Just as you change the src property of the image object, in IE you have the
    ability to change the height and width properties. just use:

    doc.img.height = 400;

    same thing for the width. Be advised though, that this will not work in
    Netscape 4.x. With Netscape, you aren't allowed access to the height and
    width properties. You might have better luck with Netscape 6 - I haven't
    tried it.

    Good Luck,

    Tom Duffy

    "Andrew" <andrzejziem@hotmail.com> wrote:
    >
    >I have a photo gallery, and I'm using
    >
    > doc.img.src = 'newimage';
    >
    >To replace an image already on the screen. This works fine only when the
    >new image is the same height/width as the old. Otherwise, IE resizes it.
    >Is there any way to load an image of a different size without resizing?
    >
    >
    >
    >
    >Andy



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center