var imageid = "";
function changeToSmall() {
// var imgObj = document.getElementById(imageid);
var imgObj=document.getElementById('hdnforimageresize');
var imageObj= imgObj.value;
imageObj.setAttribute('name', 'imageObj');
imageObj.setAttribute('src', copySrc);
imageObj.setAttribute('alt', copyAlt);
imageObj.setAttribute('onclick', 'storeObject(this);');
imageObj.setAttribute('style', 'position:absolute;height:100px;width:100px ');
}
function changeToMedium() {
var imgObj = document.getElementById('hdnforimageresize');
var imageObj = imgObj.value;
alert(imageObj);
imageObj.setAttribute('name', 'imageObj');
imageObj.setAttribute('src', copySrc);
imageObj.setAttribute('alt', copyAlt);
imageObj.setAttribute('onclick', 'storeObject(this);');
imageObj.setAttribute('style', 'position:absolute;height:150px;width:150px ');
}
function changeToLarge() {
var imgObj = document.getElementById(imageid);
alert(imgObj);
imgObj.setAttribute('name', 'imgObj');
imgObj.setAttribute('src', copySrc);
imgObj.setAttribute('alt', copyAlt);
imgObj.setAttribute('onclick', 'storeObject(this);');
imgObj.setAttribute('style', 'position:absolute;height:150px;width:150px');
}
</script>
function storeObject(obj) {
imageid = obj.id;
var hdnforimageid = document.getElementById('hdnforimageresize');
hdnforimageid.value = imageid;
alert(hdnforimageid.value);
// alert(imageid);
dividforresize = document.getElementById('btndiv');
document.getElementById('btndiv').style.display = 'block';
document.getElementById('btndiv').style.top = (copyTop - 30) + "px";
document.getElementById('btndiv').style.left = (copyLeft) + "px";
}
<div id="btndiv" style="display:none;position:absolute;top:0px;left:0px;z-index:99999;" >
<img src="Images/zoom1_Icon.png" id="first" alt="z1" style="padding-left:10px" onclick="changeToSmall(this);" />
<img src="Images/zoom2_Icon.png" id="sec" alt="z2" style="padding-left:14px" onclick="changeToMedium(this);" />
<img src="Images/zoom3_Icon.png" id="third" alt="z3" style="padding-left:20px" onclick="changeToLarge(this);" />
</div>
Images on which i want to perform resize are created dynamically.
Still i am not able to do resizing ,please give mr the suggestions for the same.