How do I add html link to image title

后端 未结 4 1906
北荒
北荒 2021-01-07 07:16

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 link

相关标签:
4条回答
  • 2021-01-07 07:43

    Are you looking for the html entities?

    If so, these are what you are looking for:

    > = >

    &lt; = <

    &#34; = "

    &#39; = '

    0 讨论(0)
  • 2021-01-07 07:53

    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();">
    
    0 讨论(0)
  • 2021-01-07 07:54

    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.

    0 讨论(0)
  • 2021-01-07 08:00

    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;
    
    0 讨论(0)
提交回复
热议问题