reserved ids?

N

Nick Wedd

I am having trouble (using IE6, with Windows), in using certain ids for
my html elements. id="c" works fine. So do most one-letter ids. But
id="i", and id="p", seem not to work.

I don't think I am using these identifiers for anything else. My guess
is that they are reserved. Can I find a list somewhere of reserved ids?

Nick
 
D

David Dorward

Nick said:
I am having trouble (using IE6, with Windows), in using certain ids for
my html elements. id="c" works fine. So do most one-letter ids. But
id="i", and id="p", seem not to work.

I don't think I am using these identifiers for anything else. My guess
is that they are reserved. Can I find a list somewhere of reserved ids?

No ideas are reserved AFAIK.

My guess is you are trying to access them as global variables. Try following
the standards:

document.getElementById('p')
 
V

VK

There are not any "reserved ids".
On the papers any id has to start with a letter and consist of letters
and numbers only.
On the practice smart guys from 3W put name (which is CDATA type) and id
in the same name space.
So browsers have to serve "the biggest possible demand", which is CDATA.
So you can assign an id="#$%^&*(" and nobody will care except
Dreamweaver and some other authoring programs (but not browsers).

So check you code through once again.
 
N

Nick Wedd

David Dorward said:
No ideas are reserved AFAIK.

My guess is you are trying to access them as global variables. Try following
the standards:

document.getElementById('p')

That is what I am doing.
document.getElementById('a')
works. So does most other single letters.
document.getElementById('p')
does not work. The elements are similar in all respects but their name
(and position). If I swap them around, it is still the one with id 'p'
that does not work. Non-working ids that I have found are 'i', 'p',
'q'.

Nick
 
L

Lasse Reichstein Nielsen

Nick Wedd said:
Non-working ids that I have found are 'i', 'p', 'q'.

I have no such problem in my testing. I guess you need to show us the
page.

/L
 
T

Thomas 'PointedEars' Lahn

VK said:
There are not any "reserved ids".
On the papers any id has to start with a letter and consist of letters ^^^^^^^^^^^^^^^^^^^
and numbers only.
[...]
So you can assign an id="#$%^&*(" and nobody will care except ^
Dreamweaver and some other authoring programs (but not browsers).

You're sure?

Please stop fullquoting and place the quote above your text, not below it.


PointedEars
 
L

Lasse Reichstein Nielsen

Thomas 'PointedEars' Lahn said:
VK wrote:

You're sure?

Pretty sure. Validators will complain, because it isn't valid HTML,
but the browsers will most likely eat it. Take this example:
---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<style type="text/css">
#\23\21 {background:yellow;}
</style>
</head>
<body>
<p id="#!">Test</p>
</body>
</html>
 
N

Nick Wedd

Lasse Reichstein Nielsen said:
I have no such problem in my testing. I guess you need to show us the
page.

I've figured out what was going wrong here. I do have global variables
called i, p, q. These were messing up the ids of the same name. Maybe
it should have been obvious that this would happen.

Nick
 
L

Lasse Reichstein Nielsen

Nick Wedd said:
I've figured out what was going wrong here. I do have global
variables called i, p, q. These were messing up the ids of the same
name. Maybe it should have been obvious that this would happen.

No, it is not obvious. The Javascript global namespace and the HTML
ID namespace have no reason to be connected, and many browsers don't.

Well, in hindsight, it does feel a little obvious, as in "I should
have known this piece of crap would do something as stupid as that" :)

/L
 
N

Nick Wedd

Lasse Reichstein Nielsen said:
No, it is not obvious. The Javascript global namespace and the HTML
ID namespace have no reason to be connected, and many browsers don't.

Well, in hindsight, it does feel a little obvious, as in "I should
have known this piece of crap would do something as stupid as that" :)

Now I find that the problem only occurs with undeclared variables. I had
thought that there was no point in declaring variables in javascript -
now I know better.

Nick
 

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

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top