JavaScirpt
<script language='JavaScript' type='text/JavaScript'>
<!--
function resize_img(st) {
var y=document.getElementById("i1").width;
if(st=='up'){
if(y<300){
y=y*2;
}
}else{
if(y>5){
y=y/2;
}
}
document.getElementById("i1").width=y;
document.getElementById("i1").height=7;
document.getElementById("msg").innerHTML='Width : ' +y ;
}
function reset_img(){
document.getElementById("i1").width=document.getElementById("i1").naturalWidth;
document.getElementById("i1").height=document.getElementById("i1").naturalHeight;
document.getElementById("msg").innerHTML='Width : ' +y ;
}
//-->
</script>
HTML
<img src=images/help.jpg id='i1'>
</div><div class='col-md-6'>
<input type=button onClick=resize_img('up') value='Expand'>
<input type=button onClick=resize_img('down') value='Compress'><input type=button onClick=reset_img() value='Reset to NaturalWidth & naturalHeight'>
<br><div id=msg></div>