/    Sign up×
Community /Pin to ProfileBookmark

resizing an image using radio buttons?

? 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

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangSep 09.2003 — [code=php]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ImagePercent</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<script type="text/javascript">
<!--
function ImagePercent(val) {
var oImg=document.images['img004'];
oImg.height=parseInt(150*val/100);
oImg.width=parseInt(250*val/100);
}
//-->
</script>

</head>
<body>
<input name="percent" type="radio" value="50%" onclick="ImagePercent(50);">50% (Smaller)<br>
<input name="percent" type="radio" checked value="100%" onclick="ImagePercent(100);">100% (good)<br>
<input name="percent" type="radio" value="150%" onclick="ImagePercent(150);">150% (Bigger)<br>

<img name="img004" src="lon 004.jpg" width="250" height="150" alt="004">

</body>
</html>
[/code]

Learn [URL=http://www.w3schools.com/default.asp]HTML and Javascript[/URL]
×

Success!

Help @Lon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...