link to specific location on page

This is a discussion on "link to specific location on page" within the Web Page Design section. This forum, and the thread "link to specific location on page are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Dec 3rd, 2006, 18:58
Reputable Member
Join Date: Mar 2006
Location: UK
Posts: 102
Thanks: 0
Thanked 0 Times in 0 Posts
link to specific location on page

I have been using <a name="#"> to create links from a menu to different specific locations on a page.
I must be doing something wrong as each menu link goes to the same anchor point each time even though I've given them separate and specific names. It works on the first one just fine but then returns to the same point from all of the other links.

By the way I would like it to be W3C validated too.

Any tips?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Dec 3rd, 2006, 21:00
Junior Member
Join Date: Oct 2006
Location: Uxbridge, West London
Age: 26
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Can you paste your code on here, i am sure it will help people to give you better assistance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Dec 5th, 2006, 13:40
Reputable Member
Join Date: May 2006
Location: Warrington, UK
Posts: 428
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

To create links to a link within the page, currently two HTML tags need to be used.


<A HREF="#top">Top</a>


<A NAME="top">


The first tag <A HREF="#top">Top</a> is different in that it has a # which represents a name statement. When the user clicks on Top, the computer would then go to the name tag, if found.


The second tag <A NAME="top"> is where the first tag will reference when clicked.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Dec 5th, 2006, 19:46
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

The proper way to do it is with id's.

<a href="#top">

<div id="top">
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Dec 6th, 2006, 15:23
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Yeah, do Ryan's way it is the correct way to accomplish this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Dec 7th, 2006, 06:37
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

I've never actually heard of using the name attibute before... You can use targets in HTML, but it's not valid XHTML.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Dec 7th, 2006, 19:32
Reputable Member
Join Date: Mar 2006
Location: UK
Posts: 102
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Ryan's way works fine. Thanks!
Just one thing
I'm using <div id="top"></div> where I want to point to
and then
<a href="#top">link</a> to point to it.

Is that the correct way or is there a better way? It validates, but just want to be sure.

Cheers
Snappy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Dec 7th, 2006, 20:46
Rob's Avatar
Rob Rob is offline
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,183
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Re: link to specific location on page

That is the correct way snappy.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Dec 8th, 2006, 17:07
Reputable Member
Join Date: Dec 2005
Location: Texas
Age: 19
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Yeah i did it on my old company site that i was working on and W3 said it was ok so you shoud be good.
RYAN's THA MAN!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Dec 8th, 2006, 17:22
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

hehehe...lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Dec 8th, 2006, 22:24
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: link to specific location on page

OMFGoogle.. Rob's alive? And yes the anchor/div method is muy bueno.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Dec 8th, 2006, 22:38
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

hehehe...Rob is alive...lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Dec 9th, 2006, 00:24
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Dec 9th, 2006, 00:42
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old Dec 9th, 2006, 02:02
Reputable Member
Join Date: May 2006
Location: Warrington, UK
Posts: 428
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

your gonna have to explain this to me guys......... hows ryans method different to mine?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old Dec 9th, 2006, 04:09
Elite Veteran
Join Date: Dec 2005
Location: On Internet
Posts: 4,859
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

hehehe...lol
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old Dec 9th, 2006, 05:33
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

They're different, but mine is correct. It's like using target="_blank" in XHTML. It works, but it's not correct.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18  
Old Dec 9th, 2006, 17:26
Reputable Member
Join Date: Jul 2006
Location: Baldock
Age: 20
Posts: 465
Thanks: 1
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Ryans way is correct and they best way in my mind but only time i used that was when i was at college and had to do a project with anchor lok for me pages

Thanx
Aarom
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19  
Old Dec 10th, 2006, 00:30
Reputable Member
Join Date: May 2006
Location: Warrington, UK
Posts: 428
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

sorry i was drunk and i couldnt see the difference lol.... yeah ryans looks more appropriate in the light of sobriety
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #20  
Old Dec 10th, 2006, 01:48
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: link to specific location on page

Haha, you must've been really drunk.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!