bonzo meier
Member
- Messages
- 47
- Reaction score
- 0
- Points
- 6
hello.
i have a menu set up like this:
<div id="menu">
<a class="active">abc</a>
<a class="passive">cde</a>
</div>
this is part of a typo3-template. whatever, what i need to do for design reasons is to replace the links (the 'abc', 'cde') with whitespace and set individual id´s to them, which means e.g. having
<a class="active" id="abc"></a>
in the end. what i tried is this:
function pimp_navi(id)
{
with (document.getElementById(id)){
var links = getElementsByTagName('a');
for(i=0;i<links.length;i++)
{
var name = links.firstChild.nodeValue;
links.id = name;
links.firstChild.nodeValue = "";
}
}
}
it is removing the link wording (nodeValues), but the id is not assigned. ideas, anyone?
peace, bonzo
i have a menu set up like this:
<div id="menu">
<a class="active">abc</a>
<a class="passive">cde</a>
</div>
this is part of a typo3-template. whatever, what i need to do for design reasons is to replace the links (the 'abc', 'cde') with whitespace and set individual id´s to them, which means e.g. having
<a class="active" id="abc"></a>
in the end. what i tried is this:
function pimp_navi(id)
{
with (document.getElementById(id)){
var links = getElementsByTagName('a');
for(i=0;i<links.length;i++)
{
var name = links.firstChild.nodeValue;
links.id = name;
links.firstChild.nodeValue = "";
}
}
}
it is removing the link wording (nodeValues), but the id is not assigned. ideas, anyone?
peace, bonzo