hc0904pcd
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...
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:)
ASKER