473,396 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

a name vs. span id?

Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?

Going to page.html#... seems to work the same for me on IE7 and FF2,
regardless. Maybe the id="..." stuff doesn't work on older browsers?
Jun 27 '08 #1
5 8225
On 05/26/08 11:27 am, yawnmoth wrote:
Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?
It depends. What is the context of the question?
Going to page.html#... seems to work the same for me on IE7 and FF2,
regardless. Maybe the id="..." stuff doesn't work on older browsers?
True.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jun 27 '08 #2
On May 26, 1:29 pm, Jim Moe <jmm-list.AXSPA...@sohnen-moe.comwrote:
On 05/26/08 11:27 am, yawnmoth wrote:Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?

It depends. What is the context of the question?
None, really. I was viewing the HTML source of some webpage, looking
for an anchor name I could link to and didn't find one. I did,
however, find an id, and, just for kicks and giggles, decided to use
that after the # and it worked, to my surprise.

All the webpages / webapps I've worked, thus far, on have used anchor
name. I don't plan on updating those applications but I might do
future ones with id's, instead.

I'm not really sure how many contexts there could be for a question
such as this?
Jun 27 '08 #3
Gazing into my crystal ball I observed yawnmoth <te*******@yahoo.com>
writing in news:036ac27a-fae2-482e-8870-3ac739244e26@
8g2000hse.googlegroups.com:
Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?

Going to page.html#... seems to work the same for me on IE7 and FF2,
regardless. Maybe the id="..." stuff doesn't work on older browsers?
The id attribute can be used for all elements except BASE, HEAD, HTML,
META, SCRIPT, STYLE, TITLE.

That means you could do:
<h1>Page Title</h1>
<p>Bla...</p>
<h2 id="heading2">Second Level Heading</h2>
<p>Bla...</p>

The A element is inline, and therefore has to be wrapped in a block
element, so more markup, eg:
<h2><a name="heading2">Second Level Heading</a><h2>

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Jun 27 '08 #4
..oO(yawnmoth)
>On May 26, 1:29 pm, Jim Moe <jmm-list.AXSPA...@sohnen-moe.comwrote:
>On 05/26/08 11:27 am, yawnmoth wrote:Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?

It depends. What is the context of the question?

None, really. I was viewing the HTML source of some webpage, looking
for an anchor name I could link to and didn't find one. I did,
however, find an id, and, just for kicks and giggles, decided to use
that after the # and it worked, to my surprise.
It's a defined behaviour and the recommended way for named anchors, even
though it will not work in really old browsers (NN4 and the like). If
compatibility with the last century is an issue, use 'a' elements with
'name' attributes, otherwise use IDs on any elements you like.

Micha
Jun 27 '08 #5
On 26 Mai, 20:27, yawnmoth <terra1...@yahoo.comwrote:
Is there any reason to use <a name="..."over <span id="..."(or
div / img / whatever)?
The a element is a semantic element, the span element is an undefined
element used for grouping text-elements.
Going to page.html#... seems to work the same for me on IE7 and FF2,
regardless. *Maybe the id="..." stuff doesn't work on older browsers?
This stuff works in all current browsers. Use the id attribute on
current elements,
don't add additonal elements just to have some fragment to refere to.
But the a-
element is there, and there is no places in the specification that say
that you can't
us an id-attibute on an a element. If I wanted an keyword to the left,
in front of some of may
paragraph, why shoud I use a span-element, if I could use an a-elment?
Nothing say I can't.

Jun 27 '08 #6

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

Similar topics

7
by: deko | last post by:
How to change a link's color based on a php variable? I have a number of links on a page: <p><a href="page1.php">Page 1</a></p> <p><a href="page2.php">Page 2</a></p> <p><a...
4
by: Grams F. | last post by:
It seems a <br> code in my XML-file is not accepted. This XML file is created using Movablestyle/Thingamablog Can anyone please analyse this HTML/XML-source, and tell me what is wrong? ...
1
by: discomiller | last post by:
Mario Mueller: Hello *, radiobuttons belong to other radiobuttons by the "name="any_value"" attribut. Thats a fakt. I got the following XML:...
1
by: Veverita | last post by:
Hi there I'm hoping that someone can help me with a question I have about javascript syntax. I got an html page that uploads an image and some text field to a database. What I'd like to do...
7
by: Brian Genisio | last post by:
Hi all, Does anyone know of a way in IE to determine the prototype name of an object? For instance, in Mozilla, I can say: junk = document.getElementById("myID"); alert(junk.toString());
0
by: Sebastiao Pereira Filho | last post by:
When I bind a server control to a repeater it renders one copy of this control for each item in the datasource collection. By doing this it changes the name of the dynamically created controls, to...
1
by: PhilMond | last post by:
An ASP.NET page was created with VS 2003 to run on NET Framework 1.1. The code for the datagrid starts with: <asp:datagrid id="DGUnpaidInvoices" runat="server" AutoGenerateColumns="False"> and...
33
by: Peng Yu | last post by:
Hi, __PRETTY_FUNCTION__ is a macro that gives function name, etc. I'm wondering if there is a macro to get the class name inside a member function. Thanks, Peng
1
by: vineetbindal | last post by:
Hi All, I am new to silverlight and i am following a tutorial. In order to connect to database in silverlight application i need to add a referance to a service. which gives me an error that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.