这是我的脚本:
function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].srcreplace('/s640/', '/s' + image_size + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
summ = summary_img;
}
var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}
上面的脚本将 /s640 替换为 /image_size。但是我能做些什么来改变'640'部分的任何值。我试过这个,但它不会奏效-
function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
if (uh>img_thumb_width) imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].src.replace('/s' + uh + '/', '/s' + img_thumb_width + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
summ = summary_img;
}
var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}