Web Analytics Made Easy -
StatCounter Jump to the content - CodingForum

Announcement

Collapse
No announcement yet.

Jump to the content

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jump to the content

    Hey guys! I was just wondering if there is a jscript code to jump to the middle (or where my content is) of the page if i click on the link on the same page. if not how would you do it anyways?

  • #2
    <a href="#content">jump to content</a>


    ...page...

    <a name="content">Content!</a><!-- you do not need text in the link -->
    ...content...

    http://www.w3.org/TR/html401/struct/links.html#h-12.1.1


    in js you would utalize element.scrollTop
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

    Comment


    • #3
      So long as you're targeting modern browsers (e.g. IE5+, FF, Opera, Safari, etc…), you don't need to use named anchors at all.
      You can use existing element id values as the destinations for fragment anchors.

      e.g.
      Code:
      <a href="#content">Jump to main content</a>
      
      …
      
      <div id="content">
      
      …
      
      </div>
      (* I used "…main content" as this helps screen readers interpret the word 'content' correctly.)
      Why you should validate your code before asking for help...

      Comment


      • #4
        Originally posted by Bill Posters View Post
        So long as you're targeting modern browsers (e.g. IE5+, FF, Opera, Safari, etc…), you don't need to use named anchors at all.
        You can use existing element id values as the destinations for fragment anchors.

        e.g.
        Code:
        <a href="#content">Jump to main content</a>
        
        …
        
        <div id="content">
        
        …
        
        </div>
        (* I used "…main content" as this helps screen readers interpret the word 'content' correctly.)


        if your going to push accesability then why limit the 'jump' link to 'new' browsers.

        it's no extra work to place a "deprecated" tag in there for backwards compatibility.

        Edit: ohh yea, and the link needs title attributes to be valid.... however i don't think his main goal is accessibility.
        public string ConjunctionJunction(string words, string phrases, string clauses)
        {
        return (String)(words + phrases + clauses);
        }
        <--- Was I Helpfull? Let me know ---<

        Comment


        • #5
          Originally posted by rlemon View Post
          if your going to push accesability then why limit the 'jump' link to 'new' browsers.

          it's no extra work to place a "deprecated" tag in there for backwards compatibility.
          (Setting aside the fact that it, of course, is extra work, albeit not much…)

          I wouldn't consider fragment anchors an issue of accessibility, but an issue of usability. The content can (or rather, should) be accessible with or without fragment links, regardless of which of the old or new methods you use to implement them.

          If an author has marked up the rest of their document(s) in a way which somehow manages to knacker all other means of accessing the destination of that fragment identifier, then the site in question has far greater accessibility issues to worry about than whether or not to use named anchors.

          Given that fragment anchors are a non-essential usability aid, it's fair game as to whether authors consider it worthwhile to add otherwise redundant markup (namely, named anchors) in order to bring obsolete UAs into the fold.

          Edit: ohh yea, and the link needs title attributes to be valid
          I trust you're not referring to validity in terms of the markup specifications.
          It's not a requirement for 'validity' in WCAG1.0*, either.
          So, in what way is the use of a title attribute needed for 'validity'?

          * The closest the WCAG 1.0 comes to making it a requirement is Checkpoint 13.1 [P2] which recommends the use of the title attribute as an optional addition which may be used to convey further information beyond the essential destination info, which should be made clear in the link text itself, and/or in alt text, in the case of image links.
          It's certainly not good practice to implement title text which simply reiterates a link's text content. Neither is it a good idea to rely on the title attribute to convey important information about a link's destination.
          Last edited by Bill Posters; Oct 7, 2006, 05:18 AM.
          Why you should validate your code before asking for help...

          Comment

          Working...
          X