28,390
社区成员
发帖
与我相关
我的任务
分享
<div class="PixelSelect">
<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign=middle><input type="button" id="btn1" value="放大" onclick="ImageChange(1)"> <input type="button" id="btn2" value="缩小" onclick="ImageChange(2)"> <input type="button" id="btn3" value="重置" onclick="ImageChange(3)" /></td>
<td align="left" valign=middle>实际长度仅供参考单位:<input name="Pixel" type="radio" id="Pixel_2" value="2" checked><label for="Pixel_2">厘米</label></td>
</tr>
<tr>
<td valign="middle" id="myImg"> </td>
<td valign="top" align="left"> </td>
</tr>
</table>
</div>
<div id="Fabric_Pic" class="Fabric_Pic2">
<div class="PicLeft">
<img id="HeightPixelPic" src="images/HeightCm.gif" />
</div>
<div class="PicRight">
<img src="<%= Request.QueryString("uppic") %>" style="margin-bottom:49px;" id="img1">
</div>
</div>
/*--------------------------------------------------------*/
function ImageChange(args) {
var oImg = document.getElementById("img1");
var w,h;
if (args==1) {
w=cc(oImg.width/236.22,2) * 1.2;
//h=oImg.height * 1.2;
oImg.width = w;
//oImg.height = h;
}
else if(args==2) {
w=cc(oImg.width/236.22,2) / 1.2;
//h=oImg.height / 1.2;
oImg.width = w;
//oImg.height = h;
}
else if(args==3){
oImg.width = $.cookie('owidth');
oImg.height = $.cookie('oheight');
}
document.getElementById("myImg").innerText="width:"+cc(oImg.width/236.22,2)+"cm; height:"+cc(oImg.height/236.22,2)+"cm";
}
function cc(v,e){
var t=1;
for(;e>0;t*=10,e--);
for(;e<0;t/=10,e++);
return Math.round(v*t)/t;
}
//我想把图片的像素转换成厘米显示,但是我测试不成功,