anchor question

  • Thread starter Thomas Scheiderich
  • Start date
T

Thomas Scheiderich

What does the following anchor snippet mean?

<a href="#" ...

I can't seem to find out what this means anywhere.

Thanks,

Tom.
 
A

Augustus

Thomas Scheiderich said:
What does the following anchor snippet mean?

<a href="#" ...

I can't seem to find out what this means anywhere.

the link references the same page
 
R

rf

Correction:
The link references nothing (the anchor is undefined) within the same
page.

Hmmm.

We had quite a lively discussion about this a couple or three months ago.

As it turns out nobody really knows for sure what this means. There is
conflicting evidence.

What it *is* is an empty fragment identifier, a fragment identifier being
the bit after the # that one can optionally put at the end of a URL to refer
to a named anchor within the page. (note the URL bit may be missing so
"#namedanchor" is perfectly valid, as is "example.com#namedanchor")

The HTML specification is totally vague about what happens with empty
fragment identifiers. In fact the spec does not even mention the
possibility. One has to delve into the RFCs.

The RFC under which HTML 4.1 supposedly operates (RFC1808) states that an
empty fragment identifier is actually invalid. It states that a fragment
identifier *must* have at least one character in it. Therefore an empty one
should be subject to browser error correction which is outside of any spec
and is at the whim of the browsers author.

There is a subsequent RFC which supercedes the above (RFC2396 IIRC) which
"corrects" the above by stating that a fragment identifier may in fact be
empty. However this RFC does not state what a UA must do with one. This RFC
is also only mentioned in the normative parts of the HTML spec IIRC. That
is, it is not "law".

One is left with what actually happens in real life:

Most of the current browsers interpret href="#" as being a link to the top
of the current document.

See
http://www.google.com.au/groups?as_q=fragment identifier cheers richard&as_ugroup=alt.html
for the relevant archived threads on this topic.
 
T

Thomas Scheiderich

Karl Groves said:
Correction:
The link references nothing (the anchor is undefined) within the same
page.

Here is the code I am using to set up some slideoutmenus. I just don't know
what it means for the "a" tag.

****************************************************************************
*****
<html>
<head>
<script language="javascript" src="ypSlideOutMenusC.js"></script>
<script language="javascript">
new ypSlideOutMenu("menu1", "right", 120, 16, 150, 30)
new ypSlideOutMenu("menu2", "right", 120, 35, 150, 30)

ypSlideOutMenu.writeCSS();
</script>
</head>

<a href="#" onmouseover="ypSlideOutMenu.showMenu('menu1')"
onmouseout="ypSlideOutMenu.hideMenu('menu1')">show menu 1</a><br>
<a href="#" onmouseover="ypSlideOutMenu.showMenu('menu2')"
onmouseout="ypSlideOutMenu.hideMenu('menu2')">show menu 2</a><br>

<div id="menu1Container"><div id="menu1Content" class="menu">this is menu
1!</div></div>
<div id="menu2Container"><div id="menu2Content" class="menu">this is menu
2!</div></div>

</body>

</html>
****************************************************************************
***********

Thanks,

Tom
 
K

Karl Groves

Thomas Scheiderich said:
page.

Here is the code I am using to set up some slideoutmenus. I just don't know
what it means for the "a" tag.

It appears that you're using a piece of code you've gotten from someone
else, from a site like hotscripts or something?
Anyway, they've placed the "#" as a dummy reference. All you have to do is
replace it with your desired destination.

-Karl
 
T

Thomas Scheiderich

Karl Groves said:
It appears that you're using a piece of code you've gotten from someone
else, from a site like hotscripts or something?
Anyway, they've placed the "#" as a dummy reference. All you have to do is
replace it with your desired destination.

You're right. It is just demo code to show how to set up and use slideout
menus. This code actually works.

It doesn't actually go anywhere. It is a link on the page that when the
mouse goes over will slide a menu out (in this case, just words not an
actual menu), and when the mouse leaves the link, it will slide back under
the link. Because it is actually used to show the menu topic, it isn't
supposed to go anywhere - those links will be on the menu that slides out
(in this case, it will slide out "this is menu 1" for the first link and
"this is menu 2" for the second menu.

I just didn't know you could use the "#" in the href tag.

Thanks,

Tom.
 
S

Starshine Moonbeam

Thomas Scheiderich said:
What does the following anchor snippet mean?

<a href="#" ...

I can't seem to find out what this means anywhere.

Thanks,

Tom.

<a href="#name">Where you want to go</a>
<a name="name"></a> (where you end up)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top