下面的代码是从html中正则取出图片,
Function getphoto(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "
tp=""
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
tp=tp & Match.value
exit for
Next
getphoto=tp
Set objRegExp = Nothing
End Function
下面的代码时进行图片按比例缩放
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);
}
}
模拟火车
模拟火车让你当回真正的火车司机,得先学会看信号灯、操作控制杆
可口的披萨美味的披萨
可口的披萨美味的披萨带您体验经营一家披萨店的乐趣。游戏画风温
定制虚拟偶像最新版
定制虚拟偶像最新版是一款超级经典有趣的日本模拟装扮类型的手游
病娇模拟器手机版正版(yandere simulator)
病娇模拟器最新版手游是一款萌妹二次元模拟游戏,玩家在游戏中可
停车场多人游戏最新版
停车场多人游戏对于喜欢停车手游的玩家是非常受欢迎的,游戏中你