在ASP.NET中,如何再添加一个较大图片后显示完整
2个回答
展开全部
显示缩略图,用JS :
function DrawImage(ImgD,maxSize)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>=1)
{
if(image.width>maxSize)
{
ImgD.width=maxSize;
ImgD.height=(image.height*maxSize)/image.width;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else
{
if(image.height>maxSize)
{
ImgD.height=maxSize;
ImgD.width=(image.width*maxSize)/image.height;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
function DrawImage(ImgD,maxSize)
{
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0)
{
if(image.width/image.height>=1)
{
if(image.width>maxSize)
{
ImgD.width=maxSize;
ImgD.height=(image.height*maxSize)/image.width;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else
{
if(image.height>maxSize)
{
ImgD.height=maxSize;
ImgD.width=(image.width*maxSize)/image.height;
}
else
{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询