sugoi_kat Posted May 11, 2006 Share Posted May 11, 2006 Hi,I don't know if this is the right place to post this, but ...I was just wondering how people implement those webpages, where there is a list of links at the top of the page, usually used for help/faq. When a user clicks on the link it directs them to the bottom where there is a paragraph on that topic and when the user clicks on the 'top' link the return to the top of the page.Kat Link to comment Share on other sites More sharing options...
Jack McKalling Posted May 11, 2006 Share Posted May 11, 2006 that is done by linking to a certain anchor at a page, like this:<a href="thispage.htm#paragraph2">paragraph2</a>And somewhere on the document:<a name="paragraph2"></a>The first will scroll to the second Link to comment Share on other sites More sharing options...
skym Posted May 11, 2006 Share Posted May 11, 2006 <a href="#nameofanchor">Part 2</a>...<a name="nameofanchor">Part 2...You might have learned this by yourself, just looking at the sources of those pages Link to comment Share on other sites More sharing options...
aspnetguy Posted May 11, 2006 Share Posted May 11, 2006 the use anchors like this <html>...<body><a name="top"></a><a href="#bottom">Go to bottom</a>....whole bunch of code....<a href="#top">Go to top</a><a name="bottom"></a></body></html> Link to comment Share on other sites More sharing options...
sugoi_kat Posted May 11, 2006 Author Share Posted May 11, 2006 thanks for your replies! Link to comment Share on other sites More sharing options...
Kosher Kid Posted May 11, 2006 Share Posted May 11, 2006 i was under the impression that it is preferable to use id= rather than name=...am i incorrect? Link to comment Share on other sites More sharing options...
aspnetguy Posted May 11, 2006 Share Posted May 11, 2006 i was under the impression that it is preferable to use id= rather than name=...am i incorrect?<{POST_SNAPBACK}> Generally yes, I do not know if this situation would work with id...some things still require name for time to time. Link to comment Share on other sites More sharing options...
Kosher Kid Posted May 11, 2006 Share Posted May 11, 2006 as a matter of fact, id's do work in this situation. i don't recall where i read it but i just have this vague recollection that the use of id's is preferable to names. if that is incorrect, i'll just keep it in mind but i've gone away from using names with no bad results. Link to comment Share on other sites More sharing options...
aspnetguy Posted May 11, 2006 Share Posted May 11, 2006 I realize that id are preferablet o name...I just didn't realise id would work for anchors Link to comment Share on other sites More sharing options...
Jack McKalling Posted May 11, 2006 Share Posted May 11, 2006 (edited) The name attribute is depreciated in Xhtml, or downgraded whatever, however, they planned reinserting the attribute into the dtd, while in forms, it was neccesary or whatever I don't know.Anyway, the name is not really forbidden But in the mean time, IDs and names should be used in conjunction, and secondly should not differ from eachother Edited May 11, 2006 by Dan The Prof Link to comment Share on other sites More sharing options...
Chocolate570 Posted May 11, 2006 Share Posted May 11, 2006 I'm pretty sure you can't access forms through their ID's in PHP...or can you? :S Link to comment Share on other sites More sharing options...
scott100 Posted May 11, 2006 Share Posted May 11, 2006 Yes you can use id's, it works ok in my PHP Version 4.4.0 The id Attribute Replaces The name AttributeHTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead.Note: To interoperate with older browsers for a while, you should use both name and id, with identical attribute values. Link to comment Share on other sites More sharing options...
Kosher Kid Posted May 12, 2006 Share Posted May 12, 2006 to aspnet guy:to make an id work for an anchor, just put the id in the appropriate tag:<h4 id="jump"> Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now