ต่อไปนี้เป็นสิ่งที่ดีงาม
การคัดลอกรหัสมีดังนี้:
FunctionFormatimg2 (เนื้อหา)
หรี่ลง
setre = newregexp
re.ignorecase = true
re.global = true
re.pattern = "(สคริปต์)"
content = re.replace (เนื้อหา "สคริปต์")
re.pattern = "<img. [^>]*src (= |) (. [^>]*)>"
content = re.replace (เนื้อหา "<imgsrc = $ 2style =" "เคอร์เซอร์: ตัวชี้" "alt =" "คลิกที่นี่เพื่อเรียกดูรูปภาพในหน้าต่างใหม่" "onclick =" "javascript: window.open (this.src);
setre = ไม่มีอะไร
formatimg = เนื้อหา
endfunction
ข้างต้นค่อนข้างแย่ แต่ความกว้างและความสูงในภาพไม่ได้อยู่ที่นั่นอีกต่อไป
การคัดลอกรหัสมีดังนี้:
functiongetphoto (strhtml)
dimobjregexp, match, matches
setobjregexp = newregexp
objregexp.ignorecase = true
objregexp.global = true
objregexp.pattern = "<img.+?>"
tp = ""
setMatches = objregexp.execute (strhtml)
foreachMatchinMatches
tp = tp & match.value
ออกจาก
ต่อไป
getphoto = tp
setObjregexp = ไม่มีอะไร
endfunction
รหัสต่อไปนี้ใช้เพื่อปรับขนาดภาพ
การคัดลอกรหัสมีดังนี้:
FunctionResizeImage (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;