JavaScript Image size variables...

Status
Not open for further replies.

Ruinous

Ars Tribunus Angusticlavius
6,596
The more I think about this, you can do this:

The script you'll need:
code:<HR>
Code:
<SCRIPT>
<!--
document.getElement("image").style.width = "300px";
document.getElement("image").style.height = "auto";
//-->
</SCRIPT>

The image tag:
code:<HR>
Code:
<IMG ID="image" SRC="src/of/image.gif" ALT="image">

(The code may be malformed, this is all off the top of my head.)

What I think this will do is set the width of the image to a certain size you specify, then the height will resize itself to keep the same h/w ratio. I haven't tested this, though, so you may have to play around with it.

OYBB
 
Status
Not open for further replies.