Re: change the ID dynamically
- From: "Bart Van der Donck" <bart@xxxxxxxxxx>
- Date: 31 May 2006 08:20:42 -0700
Thomas 'PointedEars' Lahn wrote:
Bart Van der Donck wrote:
Thomas 'PointedEars' Lahn wrote:
mayurkoul2002@xxxxxxxxx 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.
Hmmmm, that Asperger-smell in the morning :-)
--
Bart
.
- References:
- change the ID dynamically
- From: mayurkoul2002
- Re: change the ID dynamically
- From: Thomas 'PointedEars' Lahn
- Re: change the ID dynamically
- From: Bart Van der Donck
- Re: change the ID dynamically
- From: Thomas 'PointedEars' Lahn
- change the ID dynamically
- Prev by Date: Re: Creating References To Strings
- Next by Date: Re: Download and cache page without displaying it?
- Previous by thread: Re: change the ID dynamically
- Next by thread: Re: <<< State of the art web solution Online>>>
- Index(es):
Relevant Pages
|