Skip navigation
temp_techwriter
Currently Being Moderated

How to make 'top of page' (href="#") work for topics in the sub folder?

Jul 10, 2013 9:15 AM

I have used the following code in the master page:

 

<a title="Top of page" href="#"><img src="gray_up.jpg" style="border: none; margin-right: 0px; margin-top: 0px; margin-bottom: 0px; margin-left: 10px;" border="0" />

 

 

The link works fine for topics which are under the Project Files (main) folder, but the link won't work for topics under Project Files > Sub folder. Is there any way to fix this?

 
Replies
  • Currently Being Moderated
    Jul 10, 2013 9:43 AM   in reply to temp_techwriter

    I haven't tried to do anything like this in my help, but have you tried

    href="./#"

     

    That should tell it current file in current directory, if that's what's tripping Robohelp up.

    -m

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 11, 2013 7:11 AM   in reply to temp_techwriter

    What is the HTML of the hyperlink in the subfolders? I think that RH may be changing the link to href="../#" for subfolders.

     

    Greet,

     

    Willam

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 11, 2013 9:38 AM   in reply to temp_techwriter

    Hi there

     

    The problem with hyperlinks such as this in master pages is that when a topic uses the master page and it's inside a folder, the links in the master page are dutifully amended so they still work from the folder location. But as you have seen, in this case it's a bit troublesome.

     

    I'm not a "roll script off the top of your head" sort of guy, so I'd be having to employ some Google ninja to locate a suitable script to begin with, but I know you can create a JavaScript that performs a "write in" of HTML code. I think the script has statements that read something like "document.write()" or some such.

     

    So that would be my suggestion. Create a small JavaScript function that performs the task of simply writing in the link. Since it would all be in JavaScript, RoboHelp would be none the wiser that it would need to amend the code.

     

    Perhaps Willam can shed more light on this, as he seems to be more well versed in scripting!

     

    Cheers... Rick

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 1:35 AM   in reply to Captiv8r

    <script type="text/javascript">

    document.write('<a href="#">Top</a>');

    </script>

     

    Greet,

     

    Willam

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 12:25 PM   in reply to temp_techwriter

    Hi there

     

    For me, it's messy for sure, but the simplest approach was always to copy the image to all the folders. The only other way would be to amend your document.write code in a manner that references the image explicitly via a fully qualified URL.

     

    Your call... Rick

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2013 6:57 AM   in reply to Captiv8r

    Don't copy the image, instead get a link to the root of the project. And it just so happens that there is a function for that that works in WebHelp and CHM

     

    See http://www.wvanweelden.eu/blog/2012/08/03/get-relative-link-project-ro ot

     

    Greet,

     

    Willam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points