Named Anchor in JEditorPane HTML

I am loading an HTML string into a JEditorPane.
The string has some named anchors (<A NAME="blah">) that reference other locations in the HTML string.
Because I am loading the HTML string by using JEditorPane.setText, the named anchors do not work. This seems to be a problem when my HyperLinkListener tries to find the target URL.
Does anyone know how to solve this problem?

Did you find a solution for this problem in the meantime? I'd like to implement an online help feature in my newest program. I wrote a HTML text with anchors/links and the program loads this text to an JEditorPAne witch HTMLEditorKit by using the EditorPanes 'read' method. But all I got are HyperLinkExceptions from the HyperlinEventListener.
regards, hgw2

Similar Messages

  • Named Anchors and the HTML doc

    Normally, when using the the default "Flash Only" setting in the HTML publish settings, you can set the dimensions to 100 x 100 percent.  This will make the Flash movie fill the browser window and resize with the browser.
    I'm using named anchors and am using the "Flash with Named Anchors" setting in the HTML publish settings.  Everything else is the same as when I use the "Flash Only" template.  However, when I publish this HTML document it is not filling the browser window correctly.  Instead, the movie is being displayed as if I had set the movie size to 100 x 100 pixels instead of percent.  In other words, the Flash movie is squeezed into a size of 100 x 100 pixels.  Something is causing it to misinterpret percent as pixels.
    I've looked at the HTML document and it correctly says width="100%" height="100%".  This problem occurs in Firefox 3.6.  Everything displays correctly in IE8 and Safari 5.  Thank you in advance to anybody with advice or a solution.

    helpall wrote:
    > I looked in my books and help but found nothing on
    linking to anchors in Spry
    > panels. I have this sinking feeling that DW doesn't let
    you link to anchors in
    > specific panels. Or am I wrong and just need to add
    additional code to the link
    > besides the url and the #anchor name?
    It has nothing to do with what Dreamweaver will let you do
    nor not do, it has to do with what you the panels are "told" to do
    in certain situations. In this case you want to open a specific
    panel, preferably based upon the anchor name that you're already
    using. Take a look at the URL Utilities sample page, in particular
    at the last example:
    http://labs.adobe.com/technologies/spry/samples/utils/URLUtilsSample.html
    This means you'd need to get the full Spry download:
    http://labs.adobe.com/technologies/spry/home.html
    If you wanted, you could add a query string parameter like
    the above example does, but that might mean changing a lot of
    links.
    Or you could modify the example code above to "slice" out the
    first letter of the anchor and figure out the index of the tab to
    show (they use a 0 based index, so 'a' would 0 and 'z' would be 25.
    Try the following:
    <script type="text/javascript">
    <!--
    var hash = window.location.hash;
    if(hash){
    // get the character code of the upper case of the first
    letter then subtract 65
    // 'A' has a character code of 65, so the subtraction gets
    our tab index from 0 to 25
    var charCode = hash.toUpperCase().charCodeAt(0)-65;
    if(charCode < 0 || charCode > 25){ // If not in A-Z
    range, use default for 'a'
    charCode = 0;
    else{
    // Default to tab 0, or 'a' when no hash present
    var charCode = 0;
    //The defaultTab value checks to see if the url param is
    defined. If it is not, it sets it to 0.
    var
    var TabbedPanels1 = new
    Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: charCode });
    //-->
    </script>
    Danilo Celic
    |
    http://blog.extensioneering.com/
    | WebAssist Extensioneer
    | Adobe Community Expert

  • Jump to a Named Anchor when loading an HTML doc

    I have a CollapsiblePanel with a Content Link to a Named
    Anchor in info.html and I thought I could use loadURL() to load the
    page into the Div "thetext" but it does not work. Can Spry Jump to
    a Named Anchor when it loads an HTML doc?
    onClick:
    Spry.Utils.updateContent('thetext',
    '/information2.php#Insurance')
    And I also tried:
    Spry.Utils.loadURL('thetext', '/information2.php#Insurance')
    The Head:
    <script src="SpryAssets/SpryCollapsiblePanel.js"
    type="text/javascript"></script>
    <link href="SpryAssets/SpryCollapsiblePanel.css"
    rel="stylesheet" type="text/css" />
    <script language="JavaScript" type="text/javascript"
    src="Spry_P1_6_10-01/includes/SpryData.js"></script>
    <script language="JavaScript" type="text/javascript"
    src="Spry_P1_6_10-01/includes/SpryEffects.js"></script>

    On 08 Oct 2007 in macromedia.dreamweaver, antonioconte wrote:
    > Does anyone know if and how its possible to jump to a
    named anchor?
    > I need to use the behavior panel to call a page into a
    pop up and
    > jump to an anchor too - is this possible?
    Sure - just make the link to the anchor:
    <a
    href="page.php#anchor"
    onclick="popupscript('page.php#anchor');return false;">
    Open my popup window</a>
    Making the link attribute (href=) the same as the popup
    window means that
    people who are visiting your site with javascript turned off
    will also
    get the information from the page. The 'return false' in the
    onclick
    event means that the href won't fire if javascript is turned
    on.
    Joe Makowiec
    http://makowiec.net/
    Email:
    http://makowiec.net/contact.php

  • Equivalent for html named anchor

    Hi all,
    it is maybe trivial, but I can't figure out how to use something equivalent for html named anchor with in a page.
    Thanks.
    Stephan

    Hi,
    Could you please give us more details as to what you need to acheive.
    Thanks,
    Creator Team.

  • Html link to a named anchor within a PDF file?

    So, I want a link on a web page to hop to a specific part of
    a pdf file.
    Same thing as using named anchors really. The issue I see
    here is that the
    web pag (link) has no real notion of pdf's implementation of
    anchors, so how
    could it know to utilise them?
    I assume this is not possible, but need to make sure.
    Thanks.

    It is possible. You can link to a page in any pdf document,
    or link to a 'Named Destination'
    http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

  • Reating an HTML Table Contents using named Anchors

    I have a on website:
    http://www.vpea.org/Bylaws/Test/bylaws_toc.htm
    a table of contents for our Association Bylaws. Just in case
    I've created named anchors using titles such as article_I,
    article_II, etc.
    is there anyway to make when clicking on a given TOC entry
    that it will go to that point perhaps highligting it, going to that
    point the document?

    firstly, if you have multiple rows.. you need to start each row with <tr> and end with a </tr>. You just have one in the beginning and end,which will obivously give data in one row.
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");

  • Target Named Anchor in a Spry Collapsible Panel from a different page

    Let me start by saying I have combed this forum (and others) looking for a resolution to this.  I am familiar with David Powers solution on Foundationphp.com and am using that code in project to open the collapsible panel from a separate page and it works beautifullly.  The problem I have is that I want the browser to move down to a specific named anchor inside that opened collapsible panel when clicked from a different page.
    Snippets of my current code here.
    Below is the code that I have on an image that when clicked goes to the correct page and opens Panel1.  Works Perfectly!
    <a href="bamboo-species.php?col1=open#CollapsiblePanel1"><img src="images/Content/Photos/HomeScroll/blackTmbor.jpg" width="227" height="175" /></a>
    Below is the link to the .js file and the script in the head of the target page
    <script type="text/javascript" src="SpryAssets/SpryURLUtils.js"></script>
    <script type="text/javascript">
    // Grabs the values of the URL parameters for the current URL.
    var params = Spry.Utils.getLocationParamsAsObject();
    </script>
    Below is the code that I have on the target page for Panel1
    <script type="text/javascript">
    var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1", {contentIsOpen:params.col1 ? true : false},{duration: 1000});
    </script>
    If I have a named anchor say <a name="species1" id="species1"></a> down in the page, how do I target that named anchor from my link on the separate page.  I have tried adding the #species1 to the end of the link on the link page (see below) but with no luck. I believe those were the instructions on foundationphp.com site.
    <a href="bamboo-species.php?col1=open#CollapsiblePanel1#species1"><img  src="images/Content/Photos/HomeScroll/blackTmbor.jpg" width="227"  height="175" /></a>
    I hope (and suspect) that this is an easy fix, I just do not know what it is.  Any help or direction where to look is greatly appreciated.

    I once had the same issue can created a small function that allows me to "jump" to a element.
    function scrollTo( element ){
         var stylize = function( element){ return !+"\v1" ? element.currentStyle : document.defaultView.getComputedStyle( element , null ) },
              getPosition = function( element ){
                   // based on the SpryEffect's module:
                   var computedStyle, tryComputedStyle,
                        position = { x: 0, y: 0 };
                        if ( element.style.left  && /px/i.test(element.style.left) ){
                             position.x = parseInt(element.style.left, 10); // without padding
                        } else {
                             computedStyle = stylize( element );
                             var tryComputedStyle = computedStyle && computedStyle.left && /px/i.test( computedStyle.left );
                             if (tryComputedStyle)
                                  position.x = parseInt( computedStyle.left, 10 ); // without padding, includes css
                             if(!tryComputedStyle || position.x == 0) // otherwise we might run into problems on safari and opera (mac only)
                                  position.x = element.offsetLeft;   // includes padding
                        if ( element.style.top && /px/i.test(element.style.top) )
                             position.y = parseInt( element.style.top, 10); // without padding
                        else
                             if ( !computedStyle )
                                  computedStyle = stylize( element );
                        var tryComputedStyle = computedStyle && computedStyle.top && /px/i.test( computedStyle.top );
                             if ( tryComputedStyle )
                                  position.y = parseInt( computedStyle.top, 10 ); // without padding, includes css
                             if( !tryComputedStyle || position.y == 0 ) // otherwise we might run into problems on safari and opera (mac only)
                                  position.y = element.offsetTop;   // includes padding
                   return position;
              scroll( 0, getPosition( element ).y );
    So now we have a scrollTo function that accepts a pure HTML element as argument, all what is left to do is figure out if we have a hash, and if the anchor exits on the page.
    ( hopes this works, i wrote it without testing, but you get the general idea ):
    if( window.location.hash ){
         var hash = window.location.hash.substr(1), // remove the # from the hash
         element;
         // as anchors can also be used with id attributes, check that first,
         element = document.getElementById( hash );
         // maby we used name="" attribute
         if( !element && ( element = document.getElementsByName( hash )) ){
              element = element[0];
         // if we have a match:
         if( element ){
              // give the collapsible panel some time to init and update the DOM;
              setTimeout(function(){ scrollTo( element ) },0);
    \o/

  • How to close one browser window and return to a named anchor on a page in another window

    I'm working on a website that has several book images at the bottom of each page. I have set it up so when the user clicks on a book another smaller browser window opens up with a description of the book. At the bottom of book description window, I have a close button which I added the window.close() behavior to. But I'd like to not just have the window close but return the user to the bottom of the original page where I have the books, an area that I have applied a named anchor to. Any ideas on how I can get this done.
    I'd appreciate any and all help.

    I haven't tried to customize this lightbox extension much.  But I'm pretty sure the size of the box is pre-determined by image size.  Bigger image, bigger box.  And that is coded into one of the Lightbox javascript libraries.
    As to placing a link in the caption, sure.  Just paste your html link code into the Lightbox Caption Panel like so.
    <a href="http://amazon.com"> Buy now from Amazon</a>
    There is much more detailed information about Lightbox and how it works at the huddled together website.
    http://www.huddletogether.com/projects/lightbox/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb

  • Link to named anchor in current file not working

    Links to named anchors are not working at this particular site. Works with Konqueror.
    Go to this web site: http://www.kusc.org/playlist/
    Right below the calendar displays is a section "Playing this Hour" and below is list hours for AM and PM. You should be able to click one of the hours and page should skip down to that hour in the playlist. This doesn't work with FIREFOX 7. Has not work since FIREFOX 5 or 6 at least. Works with other browsers.
    Executing FIREFOX 7.0 on openSUSE 11.4. Mouseover shows the link as an anchor with #. Although, the referenced page is not the same. But again, this works with Konqueror on Linux and IE on Windows.

    Something to do with your coding. The page we opens is HTML not a PDF file. When we click on the links, it opens the PDF. I can see that destination tag along with the URL and the PDF is properly bookmarked. So check ur code.

  • Named Anchors not working in Safari

    Has anyone found a work around for named anchors not working in Safari?
    For example:
    <http://www.macbenimble.com/links.html#browsers>
    Would be greatly appreciated if anyone has any info re this?
    hollie

    That particular page fails the w3c validator: "This page is not Valid XHTML 1.0 Transitional!" Safari is one of the least forgiving of browsers for code that is not correctly written to standards. You might want to put your pages through the validator and look at the list of generated errors.
    Named anchors do work in Safari, for example is this web site faq.

  • Named Anchors not working in Apple Mail

    Hi... we have an HTML Email Newsletter. About 2 months ago the named anchors (links) from the top to different parts of the email stopped working right. For years, named anchors would simply go to the section of the email that you desired. The location of the anchor would appear at the top of the email window. Recently, the links have still worked, but Apple Mail would put the location at the bottom of the email, requiring the user to scroll down to see the content. And even more recently, now we have to double-click the link at the top to get it to work, and still incorrectly.
    At first, this seemed to only not work in system 10.6. But now it's working the same way in 10.5. I am surprised a web search hasn't found anyone else with this problem. It affects not only our emails, but any email that has a link from the top of the email to any other part of the email.
    Is this just a bug in Apple Mail or is there a fix? Thanks in advance!

    I have exactly this same problem - anchors now move the cursor so that the desired text is just off the bottom of the message window, and one has to scroll to see it.
    This is obviously an error - it is inconsistent with all web / anchor behavior I am familiar with.
    What's going on?????

  • Handeling named anchors

    Hi
    I'm trying to set up an news page on my site. I have one main frame where I want the news articles to be displayed, "News". Linked to the frame New is a html page where I write the articles month by month.
    In another frame "search" I have a list of months. in the htlm page linked to "search" I have made each month a link to a named anchor in the "news" page.
    My site is set up with css and I have a container 790x650 px. The frames are inside this container. The background is a color defined in css.
    I have two problems:
    When I search in the "search" frame the entire site scroll upwards. I want the container to stay fixed against the top of my browser and the scrolling to be contained to the frame "news". I have the container centered with a 60 px top margin. Is there a function that will keep the page from scrolling? Should I set it up another way?
    I can't get the months I use as links in my "search" doc to list with a normal spacing. How do I change this?
    Grateful for all input,
    Erik

    Hi Nancy
    Thank you for replying.
    I'm using iframes. I hope it's not as bad. Please advice if you know of another, better solution.
    My site is not up yet but you can see the page I'm referring to at www.evenemang1.se/nyheter_1.html.
    Again, Thank you for helping out!
    Erik
    30 mar 2010 kl. 20.26 skrev Nancy O.:
    You'll need to post a URL to your page.  There's no way we can help you without seeing your CSS and HTML code.
    I sure hope you're not really using FRAMES or Framesets.  That would be a tragedy because Frames are so awful the W3C saw fit to remove them from HTML 5 web standards.
    *More on Frames -
    http://apptools.com/rants/framesevil.php*
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com
    >

  • Named Anchor?

    I have used named anchors before when I am trying to link
    something within that page but when I have something on a different
    page and want to have a link take a person to a certain spot on a
    different page, it doesn't seem to be working.
    Are named anchors only relevant when on the same page? And if
    so, does anyone know what options there are to linking to a certain
    spot on a different page? Hope my question makes sense and is
    clear.
    Thank you!

    Just taking a guess here
    try something like
    <a href="page.html#namedanchor">
    What I mean is put after the link path put # and then the
    name of the anchor

  • Linking to a named anchor

    Can someone help me. I'm trying to link a java applet to a named anchor but I don't know how. Please help.

    You can't really create a direct link to an applet because an applet is an object of a HTML document. So you really have to create a link to an HTML that contains the applet. If what you're trying to do is to dynamically load an applet onto the current document, you can try to create a <DIV> (in IE or NN6) or a <LAYER> (in NN4+), create a link like this:
    Load Applet
    then, write a JavaScript function named loadApplet to load the applet into the DIV or LAYER:
    V.V.

  • Using named anchors

    Hi everybody,
    Let's say I have a two column layout with a series of links inside the left column (sidebar). Is it recommended to use named anchors to link text in one DIV to text inside another? Can I create a menu inside the sidebar and then target text inside the mainContent DIV? I've done a few tests and it seems to work well, but I'm not sure if this is the best way to do this. If not, can anybody recommend a better alternative?
    Thanks so much.
    Kind regards,
    Mark

    I don't like 1 page web sites.  I really think it's a missed opportunity.  Search engines pay more attention to sites that are broken up into logical sections with unique page titles and plenty of relevant, keyword rich content.  
    index.html
         <title>XYZ Company Home Page</title>
    products.html
         <title>XYZ Products</title>
    services.html
         <title>XYZ Services</title>
    contact.html
         <title>XYZ Contact Form</title>
    testimonials.html
         <title>XYZ Testimonials</title>
    etc....
    To give your site a uniform look & navigation, read about DW Templates. 
    http://www.smartwebby.com/web_site_design/dreamweaver_template.asp#1
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

Maybe you are looking for

  • How to develop portal application connecting to SAP R/3(backend system)

    Hello Everyone,                         Can anyone guide me on how to create portal aplication(JSPDYNPAGE), that will connect to backend SAP R/3 system, & it will fetch the data from some table from that R/3 system. Any reference material will be app

  • Imported Library - NoClassDefFoundError

    Imported Library - NoClassDefFoundError Hi I created a shared library and imported it in my application using orion-application.xml <imported-shared-libraries> <import-shared-library name="amc.common" max-version="1.0"></import-shared-library> </impo

  • Trying to understand an object/element definition in a SAPScript

    Hi, what does the following block defines in a SAP Script ? It begins defining an element, like /E      Element1 Then it defines the contents of the element /:ADDRESS PARAGRAPH AS /:  TITLE       &HADRS-ANRED& /:  NAME        &HADRS-NAME1&, &HADRS-NA

  • Urgent: client requirement

    Hi Sap Experts, when I am executing the automatic payment run system is generated 2 checks for one vendor, that vendor have two invoices each invoce amount are 10000, 20000. Here two invoices amount should come in one chck , when executing automatic

  • SAP Workflow

    Dear Gurus, Can anyone tell me where to get the SAP Workflow Manuals.....for release strategies PO/PR cheers Usman