如何添加HTML链接到图片标题 [英] How do I add html link to image title

查看:132
本文介绍了如何添加HTML链接到图片标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上需要在longdesc属性中包含html链接。我已经改变prettyphoto使用longdesc而不是图像标题,但我需要在这些描述中包含html链接。

I'm actually needing to include html links in the longdesc attribute. I've altered prettyphoto to use longdesc instead of title for images, but I need to include html links in those descriptions. I know it's possible with code for characters, I just don't remember what those are.

谢谢

Thanks

推荐答案

这可以通过 longdesc 属性来完成:

This can be done with the longdesc attribute:

<img src="theimage.png" longdesc="thedescription.html" />

然后,在thedescription.html中:

And then, in thedescription.html:

<a href="http://test.com/">Link</a>

另一种方法是使用 OBJECT 元素,如下所示:

One alternative way to do this is by using an OBJECT element, as follows:

<OBJECT data="theimage.png" type="image/png">
    <a href="http://test.com/">Link</a>
</OBJECT>

另外,既然你问过了,下面是如何在jquery中自动转换html实体:

Also, since you asked for it, here is how to convert html entities automatically in jquery:

$('<div/>').text('<a href="link.html">Some Link</a>').html();
// the above evaluates to &lt;a href=&quot;link.html&quot;&gt;Some Link&lt;/a&gt;

这篇关于如何添加HTML链接到图片标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆