473,725 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to link to a location within another document?

I have web document A which contains six links that all go to document B.
However, all hyperlinks must go to a different location within that document
(similar to anchors: A NAME= etc.).

How do I achieve this? Any pointers are appreciated. Thanks!

Nov 23 '05 #1
9 1831
Yeah wrote:
I have web document A which contains six links that all go to document B.
However, all hyperlinks must go to a different location within that document
(similar to anchors: A NAME= etc.).

How do I achieve this? Any pointers are appreciated. Thanks!


How about something like:

http://example.com/documentb.html#name3

The "name3" place needs to be an <a name="name3"></a> of course.

--
-bts
-Warning: I brake for lawn deer
Nov 23 '05 #2
On Sat, 12 Nov 2005 20:26:19 GMT, Beauregard T. Shagnasty wrote:
Yeah wrote:
I have web document A which contains six links that all go to document B.
However, all hyperlinks must go to a different location within that document
(similar to anchors: A NAME= etc.).

How do I achieve this? Any pointers are appreciated. Thanks!


How about something like:

http://example.com/documentb.html#name3

The "name3" place needs to be an <a name="name3"></a> of course.


Wouldn't using id="name3" on an appropriate element be the more modern way
to do this? I didn't see the original post, but from what you've quoted it
sounds like the original poster wanted to use something other than <a
name="name3"> (hence the phrase "similar to anchors: A NAME=").

--
Safalra (Stephen Morley)
http://www.safalra.com/hypertext/
Nov 23 '05 #3
Safalra wrote:
On Sat, 12 Nov 2005 20:26:19 GMT, Beauregard T. Shagnasty wrote:
Yeah wrote:
I have web document A which contains six links that all go to document B.
However, all hyperlinks must go to a different location within that document
(similar to anchors: A NAME= etc.).

How do I achieve this? Any pointers are appreciated. Thanks!
How about something like:

http://example.com/documentb.html#name3

The "name3" place needs to be an <a name="name3"></a> of course.


Wouldn't using id="name3" on an appropriate element be the more modern way
to do this?


Yes, it would. <g> I've been doing home repairs today, and it's an old
house.

How about: The "name3" place needs to be an <a id="name3"></a>
I didn't see the original post, but from what you've quoted it
I quoted the entire original post. It was short, so I even didn't trim
it from this reply.
sounds like the original poster wanted to use something other than <a
name="name3"> (hence the phrase "similar to anchors: A NAME=").


--
-bts
-Warning: I brake for lawn deer
Nov 23 '05 #4
Safalra a écrit :
On Sat, 12 Nov 2005 20:26:19 GMT, Beauregard T. Shagnasty wrote:
Yeah wrote:
I have web document A which contains six links that all go to document B.
However, all hyperlinks must go to a different location within that document
(similar to anchors: A NAME= etc.).

How do I achieve this? Any pointers are appreciated. Thanks!


How about something like:

http://example.com/documentb.html#name3

The "name3" place needs to be an <a name="name3"></a> of course.

Wouldn't using id="name3" on an appropriate element be the more modern way
to do this? I didn't see the original post, but from what you've quoted it
sounds like the original poster wanted to use something other than <a
name="name3"> (hence the phrase "similar to anchors: A NAME=").


Some HTML 4.01 compliant browsers and applications do not support
anchors defined by id.

"Use id or name?"
http://www.w3.org/TR/REC-html40/stru...l#idx-anchor-9

Gérard
--
remove blah to email me
Nov 23 '05 #5
On Sat, 12 Nov 2005 17:09:31 -0500, Gérard Talbot
<ne***********@ gtalbot.org> wrote:
Safalra a écrit :

Wouldn't using id="name3" on an appropriate element be the more modern way
to do this? I didn't see the original post, but from what you've quoted it
sounds like the original poster wanted to use something other than <a
name="name3"> (hence the phrase "similar to anchors: A NAME=").


Some HTML 4.01 compliant browsers and applications do not support
anchors defined by id.

"Use id or name?"
http://www.w3.org/TR/REC-html40/stru...l#idx-anchor-9


Well, Netscape 4 doesn't support id. It's a bit of a stretch to call
Netscape 4 (any incarnation) HTML 4.01 compliant. And doubtful whether
it's worth worrying about any more (users can after all always get to
the link destinations, but they have to do their own scrolling). All
more recent browsers that I've heard of support id.

The only tool I've met that couldn't cope with id is the Xenu
link-checking tool. There may be others.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 23 '05 #6
Stephen Poley <sb************ ******@xs4all.n l> wrote:
The only tool I've met that couldn't cope with id is the Xenu
link-checking tool. There may be others.


Xenu can't handle <a href="#bar">bar </a> links containing only the
fragment identifier, but it works fine if you include the file name <a
href="foo.htm#b ar">bar</a>.

--
Spartanicus
Nov 23 '05 #7
In article <un************ *************** *****@4ax.com>,
Stephen Poley <sb************ ******@xs4all.n l> wrote:
On Sat, 12 Nov 2005 17:09:31 -0500, Gérard Talbot
<ne***********@ gtalbot.org> wrote:
Some HTML 4.01 compliant browsers and applications do not support
anchors defined by id.

"Use id or name?"
http://www.w3.org/TR/REC-html40/stru...l#idx-anchor-9


Well, Netscape 4 doesn't support id. It's a bit of a stretch to call
Netscape 4 (any incarnation) HTML 4.01 compliant. And doubtful whether
it's worth worrying about any more (users can after all always get to
the link destinations, but they have to do their own scrolling). All
more recent browsers that I've heard of support id.

The only tool I've met that couldn't cope with id is the Xenu
link-checking tool. There may be others.


I had also wanted to ask about use of name and id for anchor.

I thought I saw indications elsewhere that that for xhtml the use of
name was either considered deprecated or was likely to become so (but
now I can't find that reference again). I thought I even saw a
suggestion that name might be dropped as an anchor in future xhtml
versions.

While I have decided to write all my pages in HTML 4.01 Strict, I did
want to keep my pages as easy to convert to a future XHTML as I could,
just in case.

<h2 id="foo"><a name="foo">Subh ead</a> goes here</h2>
is a variation I have seen suggested as a way of still supporting old
browsers. Since both id and name point to the same anchor, using the
same tag in their shared namespace should be allowed. At least, I think
it should be allowed. I gather this validates in xhtml.

Plus if I do some automated conversion of older pages, the addition of
id to the tag preceding an existing name anchor seems less likely to
accidentally break things if I get the search and replace wrong.
Because about 80 of my pages relate to very old Psion PDAs, I need to
avoid breaking Opera v3 and Opera v5, as released for Psion, as well as
support browsers running on mobile phones.

However what do people think of that method of doing anchors?

--
http://www.ericlindsay.com
Nov 23 '05 #8

On Tue, 15 Nov 2005, Eric Lindsay wrote:

[...]
<h2 id="foo"><a name="foo">Subh ead</a> goes here</h2>
is a variation I have seen suggested as a way of still supporting old
browsers.
Fine.
Since both id and name point to the same anchor, using the
same tag in their shared namespace should be allowed. At least, I think
it should be allowed. I gather this validates in xhtml.
You "gather"? Shouldn't be hard to verify that! But as long as
you're aiming at older browsers, I don't see the relevance of XHTML.
Keep an eye on the future, of course; but stay with HTML (strict, by
all means[1]) unless/until you have a compelling reason to move.

And it shouldn't be hard to filter out the <a name=...> markup in
converting to some future version where it had been made invalid.
However what do people think of that method of doing anchors?


I don't see anything against it as a principle. It is, after all,
making use of a deliberate W3C compatibility policy. If, as you say,
you have a particular catchment of older browsers, then it makes good
sense IMHO.

When doing CSS, though, if you want things like a:hover to only take
effect for links, and not for anchors, take care to use the specific
selectors (a:link:hover, a:visited:hover etc.).

good luck

[1] This doesn't seem to apply in your case, but when I see how many
lemmings have migrated from HTML Transitional to XHTML/1.0
Transitional, I'm convinced they are missing the key point. The
important move is from Transitional to Strict.
Nov 23 '05 #9
In article <Pine.WNT.4.64. 0511150038300.3 88@ZORIN>,
"Alan J. Flavell" <fl*****@physic s.gla.ac.uk> wrote:
On Tue, 15 Nov 2005, Eric Lindsay wrote:
<h2 id="foo"><a name="foo">Subh ead</a> goes here</h2>
I gather this validates in xhtml.
You "gather"? Shouldn't be hard to verify that! But as long as
you're aiming at older browsers, I don't see the relevance of XHTML.
Keep an eye on the future, of course; but stay with HTML (strict, by
all means[1]) unless/until you have a compelling reason to move.


It is only a proportion of my pages (the ones about Psion PDAs) that are
aimed at people who may view them with really obsolete browsers. Other
pages could be in either HTML or XHTML, although I have used and intend
to keep using HTML 4.01 Strict. XML enthusiasts keep telling me of the
wonders and advantages of XML, and all the tools that will be available
to do handy things with it. So being at least partly prepared to move
(perhaps involving converting old pages to XHTML) seems reasonable, if
the advantages ever seem overwhelming, and all the tools are present.
So far I have found it confusing rather than helpful.
[1] This doesn't seem to apply in your case, but when I see how many
lemmings have migrated from HTML Transitional to XHTML/1.0
Transitional, I'm convinced they are missing the key point. The
important move is from Transitional to Strict.


I became convinced that the important migration was to Strict rather
than Transitional, rather than HTML to XHTML some time ago. However
there seems so many conflicting opinions on the web about which
direction to take that mostly I end up confused. This is not helped by
the majority path not always seeming to be the best one.

Hence I ask simple questions here, and then try to ensure I understand
the ramifications of the answer.

--
http://www.ericlindsay.com
Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
13587
by: Mat | last post by:
How can I detect when a link has been clicked but the new page is still in the process of loading? The document.location.href property still displays the current location (understandably) not the one that's about to load. I have a page that reloads every 30 seconds in order to access live data. If a user clicks on a link just prior to the page reloading the reload takes precedence over the link click and this is annoying for the users....
14
2508
by: Brandon Hoppe | last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is for Netscape 4 only. For example, here is the main page: <html> <head> <script type="text/javascript">
1
2089
by: Aki | last post by:
Hi! I've been trying to create a home link in a document that is shown in a frameset of two frames. My aim is to show the first documents that were shown in the frames when the frameset was loaded the first time. The link works perfectly in NN4.5 and 7.1, but IE6 and Opera7 are causing headaches. I've tried to do the link with the following script:
8
8239
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) { document.location.href = document.location.href.substring(0, document.location.href.indexOf('#')) + '?' + newUrl; } else { document.location.href = document.location.href + '?' + newUrl; }
6
4944
by: juglesh | last post by:
hello, I just want to be able to use a keypress to do the same as clicking a link. such as will 'click' a certain link, while will 'click' a different link. thanks for your time, juglesh B>{)}
2
2056
by: Joris Gillis | last post by:
Hi everyone, I have this nasty little problem to which I can't find a solution: Consider an anchor <a name="Top" id="Top">Top</a> How can I follow/execute this link from within javascript? In other words, how can I mimic the action that occurs when a user has clicked a (non-existing) <a href="#Top">click me</a> link, so that the page will be shifted to the top (that's an example - not the actual goal) The link must be followed in the...
21
6583
by: news.btinternnet.com | last post by:
I can do this in IE myLink.click(); //Invoking the handler as if the user had clicked on the link themselves. I need to be able to do the same in Netscape Navigator, can anyone help ?
2
2157
by: zglazer | last post by:
Hi -- I'm working on a website that uses Javascript and CSS to show or hide portions of text on each page. There's a sort of table of contents at the top of each page, and rather than using anchor links, my client wanted the selected item from the table of contents to trigger both the showing of its corresponding text, and the hiding of the text corresponding to the other items in the table of contents. I wrote the following code to...
3
1628
by: Spartanicus | last post by:
I have a list of links using the following construct: <a href='#artane' onclick='pos(1107,281)'>Artane</a> The links offer additional functionality through JS. There are no actual fragment IDs on the page, but the fragment coding allow the links to be bookmarked. Via the window.onload event I check if a fragment ID is present in the address, if so I need to activate the 'pos' function with the appropriate arguments.
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.