请在'阅读更多'帖子摘要的链接

Please help me in this javascript for 'read more' link of post summary

本文关键字:链接 请在      更新时间:2023-09-26

我在博客上使用这段代码
这是javascript-

<script type='text/javascript'>
    var thumbnail_mode = & quot;
    yes & quot;; //yes -with thumbnail, no -no thumbnail
    summary_noimg = 430; //summary length when no image
    summary_img = 340; //summary length when with image
    img_thumb_height = 200;
    img_thumb_width = 200;
</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 (thumbnail_mode == "yes") {
            if (img.length >= 1) {
                imgtag = '<span style="float:left; padding:0px 10px 5px 0px;">
<img src="' + img[0].src + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/>
</span>';
                summ = summary_img;
            }
        }
        var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML, summ) + '</div>';
        div.innerHTML = summary;
    }
    //]]>
</script>

这是我在post元素的div中使用的代码

<div expr:id='&quot;summary&quot; + data:post.id'>
    <data:post.body/>
</div>
<a class='more' expr:href='data:post.url'> read more </a>
<script type='text/javascript'>
    createSummaryAndThumb( & quot; summary < data: post.id / > & quot;);
</script>

这是结果:

Twitter是第二大最受欢迎的社交网站。它被世界各地的名人使用。它也被称为微博网站
阅读更多

我想在'之后阅读更多链接'例如-
它也被称为微博网站阅读更多

我该怎么做,请帮帮我。

只是多个解决方案中的一个,但在锚点之前给div一个显示:inline;css样式和锚点将位于div内容的右侧。在另一个包含的css文件中,在style标记中,或在div标记中放置style="display:inline"。