DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links