我有一个自定义博客模板,它在主页上显示帖子的图像和帖子标题(链接到帖子)。我需要做的是将该图像链接到帖子网址,我已经厌倦了链接图像但整个代码中断
这是头部的java脚本代码
<script type='text/javascript'>
var thumbnail_mode = "float" ;
summary_noimg = 250;
summary_img = 250;
</script>
<script type='text/javascript'>
//<![CDATA[
function removeHtmlTag(strx,chop){
if(strx.indexOf("<")!=-1)
{
var s = strx.split("<");
for(var i=0;i<s.length;i++){
if(s[i].indexOf(">")!=-1){
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
}
}
strx = s.join("");
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+'.';
}
function createSummaryAndThumb(pID){
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length>=1) {
imgtag = '<div class="crop"><img src="'+img[0].src+'" width="300px;" height="350px;"/></div>';
summ = summary_img;
}
var summary = imgtag + '<div class="posting">' + '</div>';
div.innerHTML = summary;
}
//]]>
</script>
正文部分的代码
<div class='cover'>
<a expr:name='data:post.id'/>
<b:if cond='data:post.title'>
<h2>
<b:if cond='data:post.link'>
<a expr:href='data:post.link' expr:title='"Permanent Link to " + data:post.title' rel='bookmark'><data:post.title/></a>
<b:else/>
<b:if cond='data:post.url'>
<a expr:href='data:post.url' expr:title='"Permanent Link to " + data:post.title' rel='bookmark'><data:post.title/></a>
<b:else/>
<data:post.title/>
</b:if>
</b:if>
</h2>
</b:if>
<div class='jomore'><div class='jomorelink'><a class='anes' expr:href='data:post.url'>►</a></div></div>
<div class='bgjo'><div expr:id='"summary" + data:post.id'><a expr:href='data:post.url'><data:post.body/></a></div></div>
<script type='text/javascript'>createSummaryAndThumb("summary<data:post.id/>");</script>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>