将href链接转换为使用指纹的图像链接

时间:2012-05-15 10:54:12

标签: php jquery mysql

我看过一些好的剧本,但不是我真正可以使用的。 我的网站是php sql驱动的,我喜欢用图像更改网站上的链接 来自thumbshots。 我到目前为止的代码是:

<a href="<?php echo $link['url'] ;?>"><?php echo openld_htmlspecialchars($link['title']); ?></a>

就我的剧本而言:

$('.post-body a').each(
    function(){
        $('<img />').attr('src','http://open.thumbshots.org/image.aspx?url='+encodeURIComponent(this.href)).replaceAll($(this));
    });

我使用.replaceAll函数,但它只显示图片而不是点击链接。 我使用.insertAfter但文本链接一直显示。

这可能不是脚本代码的巨大变化,但我似乎没有找到我的问题的答案。

谢谢

1 个答案:

答案 0 :(得分:0)

我希望你在寻找...

$('.post-body a').each(function(){
    $(this).html("<img src='http://open.thumbshots.org/image.aspx?url="+encodeURIComponent(this.href)">");
});
相关问题