Link to home
Start Free TrialLog in
Avatar of hc0904pcd
hc0904pcdFlag for Australia

asked on

resize images to 100% width, keep height in proportion?

Hi,
I'm trying to show an image or a swf (depending on whether the user has flash) inside a browser window that has been already resized to full screen width and height.

The image & swf are 2:1 proportions, and I need to find a way to display them at 100% width, and to set the height to half of the height.

I have some of the pieces, but can't connect them...

for example var imgWidth = screen.availWidth; and var imgHeight = imgWidth / 2; gives me the height & width I want, but how do I write javascript variables inside an html tag?

ie <img src="images/abc.jpg" width="imgWidth" height="imgHeight"> - how do I write the width & height variables here?

thanks...



ASKER CERTIFIED SOLUTION
Avatar of DireOrbAnt
DireOrbAnt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hc0904pcd

ASKER

thanks, that's exactly what i needed :)
Avatar of DireOrbAnt
DireOrbAnt

:)