Professional Web Applications Themes

Link to specific section of a page - Coldfusion - Advanced Techniques

I am converting static html files to cfm. One of the links in the html file is coded as [url]http:///nextPage.html#section5[/url], sending the user to a specific section of the linked page. I've tried a few ways to do this in CF, such as [url]http:///nextPage.cfm##section5[/url], but I keep getting errors. Also tried it as a CFINCLUDE and CFLOCATION. Is this even possible in CF?...

  1. #1

    Default Link to specific section of a page

    I am converting static html files to cfm. One of the links in the html file is
    coded as [url]http:///nextPage.html#section5[/url], sending the user to a specific section
    of the linked page. I've tried a few ways to do this in CF, such as
    [url]http:///nextPage.cfm##section5[/url], but I keep getting errors. Also tried it as a
    CFINCLUDE and CFLOCATION. Is this even possible in CF?

    mc7628 Guest

  2. #2

    Default Re: Link to specific section of a page

    Sorry, my post was a bit inaccurate. The link is presently coded as <a
    href="nextPage.html#section5"> in the static html. The new link will need to
    read something like <a href="nextPage.cfm##section5">

    mc7628 Guest

  3. #3

    Default Re: Link to specific section of a page

    You only need the double # sign if it's enclosed w/i a <cfooutput> tag.

    Eg)



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Pound Sign Test</title>
    <meta http-equiv="Content-Type" content="text/html; cht=iso-8859-1">
    </head>

    <body>
    <a href="#mylink1">Here is an anchor outside cfoutput</a>
    <br>
    <br>
    <cfoutput><a href="##mylink2">Here is an anchor inside cfoutput</a></cfoutput>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <a name="mylink1" id="mylink1">myLink1</a>
    <br>
    <a name="mylink2" id="mylink2">myLink2</a>
    </body>
    </html>

    BSterner Guest

  4. #4

    Default Re: Link to specific section of a page

    That is fine if the link navigates within the same page. I need to navigate
    from Page A to a specific location within Page B.

    The link in PageA.html:
    <a href="PageB.html#section5">.

    PageB.html code:
    <A NAME="section5">Section 5</a>

    Now both PageA and PageB are now .cfm, and you cannot append '#section5' to
    the URL. It will cause an error.


    mc7628 Guest

  5. #5

    Default Re: Link to specific section of a page

    So if you copy the above code into a new file, name it 'links2.cfm' and change
    the hyperlinks to be...

    <a href="links2.cfm#mylink1">Here is an anchor outside cfoutput</a>
    <br>
    <br>
    <cfoutput><a href="links2.cfm##mylink2">Here is an anchor inside
    cfoutput</a></cfoutput>

    You get an error? Javascript error or CF error. It worked just fine for me.

    BSterner Guest

Similar Threads

  1. html link to a specific excel sheet
    By Vantyghem G. in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: May 23rd, 01:31 PM
  2. Link to specific Folder
    By Ken_R_Farrar@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 1
    Last Post: May 19th, 02:41 AM
  3. how to add link to a specific page in a pdf?
    By inte@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 2
    Last Post: August 13th, 01:59 PM
  4. How do I link to specific pages in another PDF file?
    By Fr._Watson@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 0
    Last Post: April 1st, 01:58 PM
  5. ??? on how to link to a specific part of an image
    By Anthony MMTS in forum Macromedia Fireworks
    Replies: 4
    Last Post: July 23rd, 02:25 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139