最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp调用图片的大小
时间:2022-07-02 23:15:00 编辑:袖梨 来源:一聚教程网
asp调用图片的大小
function ResizeImage(imageid,limitWidth,limitHeight)
{
var image = new Image();
image.src = imageid.src;
if(image.width <= 0 && image.height <= 0) return;
if(image.width/image.height >= limitWidth/limitHeight)
{
if(image.width > limitWidth)
{
imageid.width = limitWidth;
imageid.height = (image.height*limitWidth)/image.width;
}
}
else if(image.height > limitHeight)
{
imageid.height = limitHeight;
imageid.width = (image.width*limitHeight)/image.height;
}
if (imageid.parentElement.tagName != "A")
{
imageid.onclick = function(){window.open(this.src);}
imageid.style.cursor = "hand";
}
}
window.onload = InitImages;
function InitImages()
{
//图片的约束宽度和高度
var max;
var max;
var imgs = document.getElementsByTagName("img");
for(var i=0; i < imgs.length; i++)
{
var img = imgs;
if(img.width>maxWidth||img.height>maxHeight)
ResizeImage(img, maxWidth, maxHeight);
}
}
相关文章
- 《辐射4》q键使用介绍 04-26
- 《辐射4》人物介绍 04-26
- 《下一站江湖2》风卷残云获得方法 04-26
- 《The Star Named EOS未晓星程》配置要求介绍 04-26
- 《辐射4》设置中文方法 04-26
- 《辐射4》88号避难所终端机一直初始化解决办法 04-26