Href Help needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rose Girl

    Href Help needed

    Can someone help me on this little problem. I am using the following
    code in
    an xsl page.

    The directed page is written in the javascript: submitOnClick() ;

    <a href="#">
    <xsl:attribut e name="onClick"> submitOnClick() ;</xsl:attribute>
    Main Menu
    </a>

    The problem is that when href is given the # sign, the moment i click
    on the link it first jumps to the top of the page, before moving to
    the directed page.
    This can be seen when the page is longer than the screen size.

    Is there any other solution to rectify that problem ..........

    Thanks for your time
    Rose
  • Klaus Johannes Rusch

    #2
    Re: Href Help needed

    Rose Girl wrote:[color=blue]
    > Can someone help me on this little problem. I am using the following
    > code in
    > an xsl page.
    >
    > The directed page is written in the javascript: submitOnClick() ;
    >
    > <a href="#">
    > <xsl:attribut e name="onClick"> submitOnClick() ;</xsl:attribute>
    > Main Menu
    > </a>
    >
    > The problem is that when href is given the # sign, the moment i click
    > on the link it first jumps to the top of the page, before moving to
    > the directed page.[/color]

    If you don't return false on the onclick event, then the link is
    followed, so the correct code would be

    <a href="#">
    <xsl:attribut e name="onclick"> submitOnClick() ;return false;</xsl:attribute>
    Main Menu
    </a>

    Note that some visitors may not follow JavaScript links (including
    search engine spiders!) so you may want to put a link to an actual page
    in the href attribute.

    --
    Klaus Johannes Rusch
    KlausRusch@atme dia.net

    Comment

    Working...