473,802 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replacing name with id

I have a bunch of old web pages now in HTML 4.01 Strict I update every
now and then with revised material. They were written back when using <a
name=" was the normal method of including an anchor. Most of the
internal anchors follow a very standard layout, and are associated with
an h3 heading.

I was wondering whether there was any reason not to change these <a
name=" anchors to <h3 id=" anchors? I gather that all recent browsers
work fine with id on any element as an anchor. I also gather that name
is deprecated in one or another of the XHTML versions I am not yet using
due to IE. I did think it might be handy in future to be a little closer
to XHTML, if I do decide I am tired of catering to IE.

I would be making other global changes to all the pages, so this change
simply adds another few sets of global replacements to my work.

--
http://www.ericlindsay.com
Jan 6 '08 #1
16 1992
Scripsit Eric Lindsay:
I was wondering whether there was any reason not to change these <a
name=" anchors to <h3 id=" anchors?
Not really, unless you're doing some scripting that needs id attributes
for the elements.
I gather that all recent browsers
work fine with id on any element as an anchor.
Right. We can virtually ignore Netscape 4 these days.
I also gather that name
is deprecated in one or another of the XHTML versions
That's irrelevant. (Technically, it's deprecated for <aelements, but
not for all elements. The reason for the deprecation, as you know, is
that the id attribute is more logical and XML-like for the purpose.)
I did think it might be handy in future to be a
little closer to XHTML, if I do decide I am tired of catering to IE.
It doesn't matter. If you ever switch to XHTML, you will have several
changes to be made anyway, and making _this_ change is not really
special. You might use id for new pages, just as you might use
lowercase-only element names, because these are allowed in classic HTML
as well as required in XHTML. But changing existing <a name= ...>
anchors or existing use of uppercase in element names is just pointless.
_Any_ change, no matter how automated, involves a risk of errors; some
assumptions may just fail, and your regular expression (or whatever) may
somehow miss some special case and produce a mess. It's better to take
risks only when there is something to be won, i.e. when performing the
(full) conversion to XHTML for some real reason.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 6 '08 #2
Sun, 06 Jan 2008 14:45:14 +1000 from Eric Lindsay
<NO************ *@ericlindsay.c om>:
I have a bunch of old web pages now in HTML 4.01 Strict I update every
now and then with revised material. They were written back when using <a
name=" was the normal method of including an anchor. Most of the
internal anchors follow a very standard layout, and are associated with
an h3 heading.

I was wondering whether there was any reason not to change these <a
name=" anchors to <h3 id=" anchors?
I can't think of any. IIRC, a very old version of Netscape honored
name= but not =id, but that's been quite a few years now. Just be
careful in your script to remove the associated </a>, even if it's
not on the same line.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Jan 6 '08 #3
Scripsit Jukka K. Korpela:
Scripsit Eric Lindsay:
>I was wondering whether there was any reason not to change these <a
name=" anchors to <h3 id=" anchors?

Not really, unless you're doing some scripting that needs id
attributes for the elements.
Oops, I seem to have misread the question. I answered the question "in
there any reason...".

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jan 6 '08 #4
In article <MP************ ************@ne ws.individual.n et>,
Stan Brown <th************ @fastmail.fmwro te:
Sun, 06 Jan 2008 14:45:14 +1000 from Eric Lindsay
I was wondering whether there was any reason not to change these <a
name=" anchors to <h3 id=" anchors?

I can't think of any. IIRC, a very old version of Netscape honored
name= but not =id, but that's been quite a few years now. Just be
careful in your script to remove the associated </a>, even if it's
not on the same line.
Many thanks. That old Netscape was probably what I was recalling as a
possible reason not to make the changes.

Thanks for mentioning the associated </a>. I did handle that correctly,
for once. The first few sets of changes I made did reveal that some of
my earlier pages were less like the later ones than I originally
expected. Perils of not using a program to generate my web pages.

There were some errors. The mess that Jukka (correctly) predicted did
occur, however only visible in a dozen or so pages. I had no doubt I
would find other flaws when I validated some of the pages again.

The big error was that id can not start with a number, and all my names
were actually automatically generated dates like 20080107a 20080107b and
so on. I wonder why that did not throw up a validation error when I had
<a name="20080107a " I had never noticed that I had thousands of such
name errors.

I can certainly see why Jukka cautions against taking risks with regular
expression changes over heaps of files. However I only seem to improve
by running up against vast numbers of my past errors.

--
http://www.ericlindsay.com
Jan 7 '08 #5
Mon, 07 Jan 2008 22:34:17 +1000 from Eric Lindsay
<NO************ *@ericlindsay.c om>:
The big error was that id can not start with a number, and all my names
were actually automatically generated dates like 20080107a 20080107b and
so on. I wonder why that did not throw up a validation error when I had
<a name="20080107a " I had never noticed that I had thousands of such
name errors.
I used similar names to anchor revision points in my pages. When I
switched to IDs I got the same validation errors you did, so I
prepended a U to them.

I remember researching the issue, but it was a few years ago. I can't
remember whether names starting with numerics were legal in name=, or
were illegal but just not found by the validator.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Jan 8 '08 #6
Stan Brown wrote:
>
I can't
remember whether names starting with numerics were legal in name=, or
were illegal but just not found by the validator.
http://www.w3.org/TR/html401/types.html#type-id

I don't know if the validator ever checked values on the name attribute,
though.
--
Berg
Jan 8 '08 #7
in comp.infosystem s.www.authoring.html, Stan Brown wrote:
Mon, 07 Jan 2008 22:34:17 +1000 from Eric Lindsay
<NO************ *@ericlindsay.c om>:
The big error was that id can not start with a number, and all my names
<a name="20080107a " I had never noticed that I had thousands of such
When I switched to IDs I got the same validation errors you did, so I
prepended a U to them.
Which then breaks all external links.

--
Lauri Raittila <http://www.iki.fi/lr>
Jan 9 '08 #8
Stan Brown wrote:
Mon, 07 Jan 2008 22:34:17 +1000 from Eric Lindsay
<NO************ *@ericlindsay.c om>:
>The big error was that id can not start with a number, and all my names
were actually automatically generated dates like 20080107a 20080107b and
so on. I wonder why that did not throw up a validation error when I had
<a name="20080107a " I had never noticed that I had thousands of such
name errors.

I used similar names to anchor revision points in my pages. When I
switched to IDs I got the same validation errors you did, so I
prepended a U to them.

I remember researching the issue, but it was a few years ago. I can't
remember whether names starting with numerics were legal in name=, or
were illegal but just not found by the validator.
No a NAME and ID must start with a letter [A-Z,a-z]

http://www.w3.org/TR/html4/types.html#type-name

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jan 9 '08 #9
Lauri Raittila wrote:
in comp.infosystem s.www.authoring.html, Stan Brown wrote:
>Mon, 07 Jan 2008 22:34:17 +1000 from Eric Lindsay
<NO*********** **@ericlindsay. com>:
>>The big error was that id can not start with a number, and all my names
<a name="20080107a " I had never noticed that I had thousands of such
>When I switched to IDs I got the same validation errors you did, so I
prepended a U to them.

Which then breaks all external links.
How? If www.example.com/somepage.html#00021 is a invalid URL

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jan 9 '08 #10

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

Similar topics

8
1606
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
1
1496
by: Søren Schimkat | last post by:
Hi everyone I´m having some problems with replacing one form with another. The first problem is the the replace function only works once - and the second problem is that the thml code dosn´t get interpreted.. but is treated as plain text. You can se a short example here: http://www.schimkat.dk/forms.htm Some hints on that one would be nice.
2
2064
by: thehuby | last post by:
Isn't inserting good data and getting it out of a db a pain in the a$$? I am going to be using the Markdown text to HTML parser (http://daringfireball.net/projects/markdown/dingus) for creating HTML from user input (for a bespoke CMS) so that users can put in their own headings, lists and links etc. This is great and gets round all the issues of apostrophes etc. when inserting informaiton into a database for me.
3
2141
by: Muntz | last post by:
Hi - we are MSDN Enterprise subscribers, our no-spam address is munter@computershare.com We are currently trying to replace a SoapToolkit web-service with a .NET WebMethod implementation, but can't seem to get the WSDL to line up properly. I consulted the migration document: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/migrsoapwebserv.asp I then used wsdl.exe to create an abstract class definition...
6
24379
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an XSLT and replace all occurances of &lt; with < and &gt; with >.
2
6548
by: David | last post by:
Sent this to alt.php a couple of days back, but doesn't look like I'll get an answer, so trying here. I'm trying to convert a script to use friendly URLs, I've done this before, but my PHP skills are quite basic so far, far from proficient at this. ..htaccess file- DirectoryIndex default.php index.asp index.html index.htm index.php
9
24752
by: Prakash Singh Bhakuni | last post by:
am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice. Any ideas on why this is happening or a workaround? I'm testing on IE Thanks! <html> <head></head> <body> <form name="test_form" method="post" action="test.jsp">
1
4508
by: patelgaurav85 | last post by:
Hi, I want to convert xml in one format into another xml format shown below Input xml : <Name> <Name1> <Name11>Name11</Name11> <Name12>Name12</Name12>
1
2336
by: susan10 | last post by:
Im new to Coldfusion, and here is what i would like to do: I'm using a html-editor on one cfm-page, and saving the text in a database: --mytext written i the html-editor ---------------------- Nunc libero ligula volutpat ac aliquet id laoreet ac lacus.
29
19296
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my site and so far doing this has saved about 8KB of javascript (lots of ajax/dynamic elements). I just
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10538
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
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
10285
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
9115
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
7598
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
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
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
3792
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.