开发者

How do I add html link to image title

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


This can be done with the longdesc attribute:

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

And then, in thedescription.html:

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

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>

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;


I'm not sure if this is what you're looking for, but you can use Walter Zorn's wz_tooltip to show a tooltip with any kind of content.

And example of use:

<img src="theimage.png" onmouseover="Tip('<a href=\'http://test.com/\'>Link</a>');" onmouseout="UnTip();">


The longdesc attribute is an URI, not a place to add code. In other words, you'll need to create a page that the longdesc links to. This page is where you'll make a thorough description of what's on the image.


Are you looking for the html entities?

If so, these are what you are looking for:

&gt; = >

&lt; = <

&#34; = "

&#39; = '

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜