Results 1 to 4 of 4

Thread: Want clickable image

  1. #1
    Join Date
    Jul 2014

    Unhappy Want clickable image

    Hello everyone , I need a little help from you to edit my blog template.
    This is about a .xml blogger template. I have thumbnail images of my posts on the homepage. By default the image is not clickable. I tried to edit the code to make the thumbnail a image-link to my post page. How can I do this?
    I am giving the codes below. Please tell me where to edit

    function createSummaryAndThumb(pID){
    var div = document.getElementById(pID);
    var imgtag = "";
    var img = div.getElementsByTagName("img");
    var summ = summary_noimg;
    if(img.length>=1) {
    imgtag = '<img src="'+img[0].src+'" class="pbtthumbimg"/>';
    summ = summary_img;

    var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
    div.innerHTML = summary;

    <div class='post-body entry-content'>

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>
    <b:if cond='data:blog.pageType != &quot;item&quot;'>
    <div expr:id='&quot;summary&quot; + dataost.id'><dataost.body/></div>
    <script type='text/javascript'>createSummaryAndThumb(&quot;summary<dataost.id/>&quot;</script>
    <b:if cond='data:blog.pageType == &quot;item&quot;'><dataost.body/></b:if>

    <b:if cond='data:blog.pageType == &quot;static_page&quot;'><dataost.body/></b:if>

    <b:if cond='data:blog.pageType != &quot;static_page&quot;'>
    <b:if cond='data:blog.pageType != &quot;item&quot;'>
    <div style='float:right;padding-right:10px;margin-top:10px;'>
    <span class='morenbt'><a expr:href='dataost.url'>Read More</a></span>

  2. #2
    Join Date
    Mar 2012
    I do not understand why you need JS to make an image clickable? The standard way to make an image clickable is with an <a> tag. E.g.

    <a href="target.html"><img src="path/image.jpg" alt=""></a>

    This makes the image "image.jpg" clickable and links to "target.html". Amend the names and paths to suit your requirements.

  3. #3
    Join Date
    Jul 2014
    jedaisoul, thanks for ur help. But it doesn't solve my problem.
    Whenever I add an image with a link on my Post pages, the JS generates a thumbnail on the homepage but it doesn't contain the link. I want to add <a expr:href='data:post.url'> so that it will create a thumbnail with the post page URl. But I don't know where to add this.
    Can u help?

  4. #4
    Join Date
    Mar 2007
    When posting any kind of code, please wrap that code in the appropriate forum tags.
    --> JavaScript Frameworks like JQuery, Angular, Node <--
    ... and please remember to wrap code with forum BBCode tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center