ما يلي واحد جيد جدا
نسخة الكود كما يلي:
FunctionFormatimg2 (المحتوى)
Dimre
setre = newregexp
re.ignorecase = صحيح
re.global = صحيح
re.pattern = "(نص)"
content = re.replace (المحتوى ، "البرنامج النصي")
re.pattern = "<img. [^>]*src (= |) (. [^>]*)>"
content = re.replace (المحتوى ، "<imgsrc = $ 2style =" "cursor: pointer" "alt =" "انقر هنا لتصفح الصور في نافذة جديدة" "onClick =" "javaScript: window.open (this.src) ؛" "onload =" javaScript: resizepic (this) ""
setre = لا شيء
formatimg = المحتوى
الوظيفية
ما سبق سيء بعض الشيء ، لكن العرض والارتفاع في الصورة لم يعد هناك
نسخة الكود كما يلي:
FunctionGetPhoto (Strhtml)
Dimobjregexp ، مطابقة ، مباريات
setObJregexp = NewRegexp
objregexp.ignorecase = صحيح
objregexp.global = صحيح
objregexp.pattern = "<img.+؟>"
tp = ""
setMatches = objregexp.execute (strhtml)
foreachMatchinMatches
tp = tp & match.value
الخروج
التالي
getPhoto = tp
setObJregexp = لا شيء
الوظيفية
يتم استخدام الرمز التالي لتوسيع نطاق الصورة
نسخة الكود كما يلي:
وظيفة ignerSizeImage (ImageId ، limitwidth ، limitheight)
{
متغير = newImage () ؛
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 ؛