javascript duty 'get component progenitor class' assign
my difficulty sincerely simple: duty gets id 'this' <li> component formed progenitor id <ul>. used work glorious nonetheless any more, i presumably need have <ul> classes instead id while still being means distribute id 'current' tide element, change css.
function myfunction(element) {
liarray = document.getelementbyid("leftlist").childnodes;
i = 0;
while (liarray[i]) {
liarray[i].id = "";
i++;
}
element.id = "current"; // element.classname ?
}ul#leftlist {
background-color: rgb(205, 205, 205);
}
ul#leftlist li#current {
color: rgb(96, 176, 255);
background-color: 218, 218, 218);
}
ul#leftlist li {
color: rgb(86, 86, 86);
}
#leftlist a:link {
color: rgb(86, 86, 86);
background-color: #ddd;
}
#leftlist a:active {
color: rgb(96, 176, 255);
background-color: rgb(218, 218, 218);
}<ul id="leftlist">
<li onclick='myfunction(this);'>
<a href="123" bla bla </a></li>
<li onclick='myfunction(this);'> .... etc.</li>
</ul>perhaps i need change css. worked before nonetheless tide id being effective ul#leftlist li a takes priority even i distribute id="current" around javascript.
Comments
Post a Comment