Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2010, 07:46 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default Linking to an ID in same page

Hi,

I've a template in which I'm putting my data. Template is basically divided into two parts, one is the upper part that includes header and navigation and the second part is the bottom area or it could be said as content area. The content area works as a slide. If I click on any navigation button in top, lets say if I click on "About us" button, the content area scrolls and displays the about us page.

Now what I want is, I've a "About us" link on the main page (in this case on the first slide) and I want it to link with the about us slide (page). Means when I click on About Us link (that is not the navigation button), the About Us page will appear.

The About Us content has an ID :
<div id="about-us">

And on the about us link I'm writing it like this:
<a href="#about-us">About Us</a>

So this is the problem I'm facing, what's wrong am I doing? Please provide me some solution, I'll be very greatful.
 
Old January 7th, 2010, 11:49 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

:S The code your showing is correct, I believe. The only thing I can think of is maybe it doesn't like the hyphen. Try renaming it to "aboutUs" and see if that works.

To do a link to a location on the same page you want to assign an id to the element and format the attribute href="#elementId", so you're doing that part exactly write.

One other idea... the web browser is only matching the characters and is not "smart" about identifying related symbols; with so many visually similar encodings in UTF8 it's possible that they look the same but that one or more of your characters are actually different encodings. Whenever I have a situation where this might be a problem, you can make sure the two locations are identical by copying the id from the div and pasting it into the href. That ensures that they're identical. Since "about-us" has mostly letters which would be typed in on the keyboard, the hyphen sticks out as the most likely character responsible if that is the problem.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old January 8th, 2010, 05:33 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default

Thanks for the reply and suggestions. I've tried it without hyphen but still same, the page / content area doesn't scroll to About us page
 
Old January 8th, 2010, 02:58 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

I'll try to get you working if I can. In the first place, thanks for providing such a nice summary of your problem and not wasting our time by posting an entire page of code.

In the second place, what you're doing should so totally work. NOW I need to see more of the code. Can you give me a link so I can do a view source on the page and try to find the problem? If it's not posted, then go ahead and post the whole page. I'd like to see from !DOCTYPE to </html> tag.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old January 12th, 2010, 09:35 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default

Thanks for the reply. Here is the link where you can view the site.

http://www.trueweblogics.com/slide_test

If you click on the "About us" tab on top, the content section scrolls and displays the related page. You can also see a "About us" link on the main page, that I want to link with 'about us' page.





Similar Threads
Thread Thread Starter Forum Replies Last Post
If Else linking to HTML page nodster PHP How-To 1 June 7th, 2007 07:29 AM
Linking to specific areas in a new page CathyM BOOK: Beginning ASP 3.0 2 August 2nd, 2005 09:23 AM
Linking opml/xml files to a html page helensobrien XML 0 February 21st, 2005 01:48 PM
Linking to the last accessed page mahulda ASP.NET 1.0 and 1.1 Basics 4 July 27th, 2004 12:49 AM
Page Linking though DropDown Lists mahulda ASP.NET 1.0 and 1.1 Basics 2 April 23rd, 2004 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.