- Back to Home »
- javascript »
- change image size using javascript
Posted by : food
Friday, 31 May 2013
Change any image size with the using of Radio Button in javascript | Change any image size using javascript
Hello, friends this javascript code is very easy to understand.
First Open any Text Editor.
Type below code or copy & paste into Editor.
Now, Save the file as .html extension.
Code is given below:
<html>
<head>
<script language="javascript">
function f2()
{
document.getElementById('i1').height=400;
document.getElementById('i1').width=500;
}
function f3()
{
document.getElementById('i1').height=600;
document.getElementById('i1').width=700;
}
function f4()
{
document.getElementById('i1').height=800;
document.getElementById('i1').width=900;
}
function fo()
{
document.getElementById('i1').height=200;
document.getElementById('i1').width=300;
}
</script>
</head>
<body>
<form name="f1">
<input type="radio" name="r1" onClick="fo()">200 X 300
<input type="radio" name="r1" onClick="f2()">400 X 500
<input type="radio" name="r1" onClick="f3()">600 X 700
<input type="radio" name="r1" onClick="f4()">800 X 900
<img id="i1" name="img1" src="gun.jpg" height=150 width=250>
</form>
</body>
</html>
See the Output