[thelist] JS: Resizing an image?

Anthony Ettinger apwebdesign at yahoo.com
Thu Aug 25 11:38:30 CDT 2005


http://www.xs4all.nl/~sbpoley/webmatters/resize.html

--- Frank <lists at frankmarion.com> wrote:

> 
> I'm trying to resize an image by using javascript.
> The user will upload an 
> image, the image will float left in a div. Right
> now, if the div has a 
> lesser height, the image sticks out, if the div has
> a greater height, the 
> images floats loosely. I want to make it so that the
> height of the image 
> always matches the height of the div. In this case,
> it usually means 
> re-adjusting it's dimension by some 2-15px. It's
> just one of those things 
> use to satisfy picky designers.
> 
> Here's what I've got, my problem seems to be in
> changing the size of the 
> image itself.  The odd things is that I get no
> errors
> 
> 
> How would you go about it?
> 
>     <script type="text/javascript">
>        i =
> document.getElementById('artist_portrait')
>        ih = i.height;
>        h =
> document.getElementById('container').offsetHeight;
> //div
>        // i.setAttribute("height",h);  // don't work
>         ih = h; // this doesn't work either
>        i.height = h;
>        // alert(i +' '+ih+' '+h);
>    </script>
> 
> See the following url for what it is that I need to
> adjust
> http://www.lbfineart.com
> 
> 
> 
> Frank Marion     lists at frankmarion.com      Keep the
> signal high.
> 
> 
> 
> -- 
> 
> * * Please support the community that supports you. 
> * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip
> Harvester 
> and archives of thelist go to:
> http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 


Anthony Ettinger
ph: (408) 656-2473
blog: http://www.chovy.com


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


More information about the thelist mailing list