Well, thank you !! Now it works..... nut not at all. Here's the new
code
/***********CODE BEGIN
****************************************************************/
public class HTMLLinkkDestino extends Widget {
private static native boolean detectIE()/*-{
return /MSIE (\d+\.\d+);/.test(navigator.userAgent)
}-*/;
private static boolean isIE = detectIE();
public HTMLLinkkDestino(String text, String anchorName) {
Element element;
if (isIE) {
element = DOM.createElement("<a NAME=\"" + (anchorName
== null ? "" : anchorName) + "\"></a>"); //" + (text == null ? "" :
text) + "
} else {
element = DOM.createAnchor();
DOM.setElementAttribute(element, "name", anchorName ==
null ? "" : anchorName);
}
DOM.setInnerHTML(element, text == null ? "" : text);
setElement(element);
}
/***********CODE END
****************************************************************/
The fact is the anchors work, but in IE ( I hate this browser ;) ),
when the user press the source link, the page scrolls to the point;
and a second later it rechages itselft.... losing the state of the
application. Only in IE.
I'm looking about preveting the event, but I'm not sure how to make it
work... ufff
Oskar
On 19 dic, 17:50, "[email protected]" <[email protected]>
wrote:
> Element element = DOM.createElement("<a NAME=\""+(anchorName == null ?
> "" : anchorName)+"\"></a>");
>
> You would have to create the anchor like this in IE but it does not
> work for Firefox.
>
> On Dec 19, 10:59 am, obesga <[email protected]> wrote:
>
> > ///**** I don't like to re-post, but here's the complete code of what
> > I'm trying to to *****///
>
> > public class AnchorsPanel extends Composite {
>
> > private FlowPanel fpLinks;
> > private VerticalPanel verticalPanel;
>
> > public AnchorsPanel() {
> > verticalPanel = new VerticalPanel();
> > verticalPanel.setStylePrimaryName("caronte-VerticalTabPanel-
> > VPanel");
> > fpLinks = new FlowPanel();
> > verticalPanel.add(fpLink);
> > this.initWidget(verticalPanel);
> > }
>
> > // ADD A WIDGET
> > public void addTab(String name, String refName, Widget widget) {
> > HTMLLinkSource sourceLink = new HTMLLinkSource(name,refName);
> > HTMLLinkTarget targetLink = new HTMLLinkTarget(name,refName);
> > fpLinks.add(sourceLink);
> > verticalPanel.add(targetLink);
> > verticalPanel.add(widget);
> > }
>
> > // CLASS FOR LINK
> > public class HTMLLinkSource extends Widget {
>
> > public HTMLLinkSource(String text, String anchorName) {
> > Element element = DOM.createAnchor();
> > setElement(element);
> > DOM.setElementAttribute(element, "href", anchorName ==
> > null ? "" : "#" + anchorName);
> > DOM.setInnerText(element, text == null ? "" : text);
> > }
>
> > }
>
> > // CLASS FOR TARGET
> > public class HTMLLinkTarget extends Widget {
>
> > public HTMLLinkkDestino(String text, String anchorName) {
> > Element element = DOM.createAnchor();
> > setElement(element);
> > DOM.setElementAttribute(element, "name", anchorName ==
> > null ? "" : anchorName);
> > DOM.setInnerText(element, text == null ? "" : text);
> > }
>
> > }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---