Bart Van der Donck wrote:
Thomas 'PointedEars' Lahn wrote: ma***********@gmail.com wrote: > [assign ID attribute dynamically to the html tags]
That is as impossible as your posting "style".
Why would that be impossible ?
<html>
<body>
<p>content</p>
<script language="javascript" type="text/javascript">
The `language' attribute is deprecated long since, and your markup
is not Valid; especially, the missing DOCTYPE declaration triggers
Quirks Mode, which can change DOM behavior.
document.getElementsByTagName('p')[0].setAttribute('id','myID');
alert(document.getElementById('myID').innerHTML);
</script>
</body>
</html>
That is setting the attribute, not changing it. Note the Subject header.
Furthermore:
- This requires other DOM methods that may not be available.
- It is known to be not possible for some elements in some DOMs
(IIRC there are issues in the IE DOM).
- setAttribute() implementations are known to be buggy.
PointedEars
--
In the First World War, 13 million people were killed. In the Second
World War, 40 million people were killed. I think that if a third war
takes place, nothing is going to be left on the face of earth.
-- Shakira, 2003-02-05 @ MTV.com