Jump to content

a href question


ahschmidt
 Share

Recommended Posts

I was looking at a site that had urls in HREF attributes listed like CSS IDs...<a href="#thisLink" id="thisLinkID"><span></span></a>This was a link that changed its graphic, and updated only part of the screen. I am curious what the story behind this is, anyone have any wisdom on this? Is it only an HTML5 thing?Here is the site I was looking at: http://www.w3.org/html/logo/There are 8 icons that update the panel to the right of the icon region. Its about halfway down the page.

Link to comment
Share on other sites

There isn't anything real tricky about this. It is all static content manipulated by advanced javascript and CSS definitions. Using hover actions and javascript to change the propoerties of na object (div) you can swap out content - view the source and you'll see all the content there, it's just swapped out using hover and js.Expanding that concept, one would use something called AJAX - which would dynamically populate that region of content through javascript calls to a remote database, where you would not be able to see anything in the source code that resembles the content displayed on the page.Does that help?

Link to comment
Share on other sites

The hash (I think that's what its called...) in an href attribute can also be used to link to a specific section of a page. Say you have a really long document, and you put a table of contents at the top with links to different portions of the page:<h2>Table of Contents</h><a href='#section1'>Section 1</a><a href='#section2'>Section 2</a><a href='#section3'>Section 3</a>Then further down the page you have the section headings:<h2 id='section1'>Section 1</h2>....<h2 id='section2'>Section 2</h2>....<h2 id='section3'>Section 3</h3>....This sort of thing doesn't require any JavaScript. It's pure HTML.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...