Click to See Complete Forum and Search --> : resizing an image using radio buttons?


Lon
08-26-2003, 10:38 AM
:confused: I have been trying to write a little script to change an image size by percent using radio buttons? I don't need to use radio buttons but only want to give an exact input that a button would give me. My script in "HTML" is below. (it don't work yet)......

<form name="cSize" method="document">
<input name="percent" type="radio" value="40%">40% (Smaller)<br>
<input name="percent" type="radio" checked value="50%">50% (good)<br>
<input name="percent" type="radio" value="70%">70% (Bigger)<br>

<img src="lon 004.jpg" getimagesize("lon 004.jpg");width="auto" height="percent" alt="004">
</form>

can anyone help with this? I think that it needs to be done in java?
Lon

diamonds
08-26-2003, 11:32 AM
not java - javascript.
Now, are you trying to do size compared to its current size (100% = keep size, 50%=shrink by 1/2, 200% enlarge by 2)?

this is how you would resizr an image:
document.getElementById('image_name_and_ID').width = 100;
Make sure the height tag on the image you want to resize is not supplied, like this:
<img src="image.gif" width=200 id='imagename' name='imagename'>

Note when you specify percent, the 100% refers to the largest size it can take up. Try containing it inside a table cell than if you supply 200%, it will force the table cell to widen.