I want all my hyperlinks to open their corresponding pages, added to the url #top. I don't want to put it manually everytime I type the hyperlink.
Thanks
I want all my hyperlinks to open their corresponding pages, added to the url #top. I don't want to put it manually everytime I type the hyperlink.
Thanks
I don't think this can be done in HTML. Why do you want it? I ask because I wanted this once too except, back then I just went ahead and coded it into each link. I wanted it because I had the:
<a name="top"></a>
anchor a little ways down the pages and I liked the way a new page looked when it was scrolled slightly. Later I discovered that setting the top margin to 0 on the pages accomplished the same thing with much less coding and none of the jumpiness that the anchor method can sometimes cause. What is your reason?
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
It can be done with Javascript:
Not compatible with non-JS browsers. Make sure it's nothing vital. And yes, you would be better doing it manually or, better still, restyling the linked page.Code:<script type="text/javascript"> var i, a = document.getElementsByTagName("a"); for(i=0;i<a.length;i++) a[i].href += "#top"; </script>
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Well, I need it because I'll be having 2 frames in my website. One is the menu, and the other contains the main content (articles). Each link in the former is supposed to open a page in the latter. So, when I scroll down the menu, and I click a link, I want the upcoming page to appear from its top, not from where I click the link in the menu.
Hope I was clear.
The new page opening in the 'content' frame from its top would be the default behavior if everything is as you have explained it and the new pages are independent pages and not themselves also frames pages. Perhaps a link to a demo that shows the problem would be in order.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks