Hi all,
I have a page with a few tabs and i am trying to get rid of the onclick links i have inside the html but i am really getting confused:
inside my HTML i have this code:
<ul id=”tabs”>
<li id=”tab0″ class = “Selected” onmouseover=”style.cursor=’pointer’;”><a><center>Product Summary</center></a></li>
<li id=”tab1″ class = “NotSelected” onmouseover=”style.cursor=’pointer’;”><a><center>Tech Specification</center></a></li>
<li id=”tab2″ class = “NotSelected” onmouseover=”style.cursor=’pointer’;”><a><center>Essential Extras</a></center></li>
<li id=”tab3″ class = “NotSelected” onmouseover=”style.cursor=’pointer’;”><a><center>Product Feedback</a></center></li>
</ul>
than in my javascript i have this:
window.onload = prepareTabLinks();
function prepareTabLinks(){
var links = document.getElementsByTagName(“li”);
for(var i = 0; i < links.length; i++){
if(links[i].className == “NotSelected” || links[i].className == “Selected”){
links[i].onclick = function(){
ChangeTab(this,”div”+i);
}
}
}
}
i am using firebug to debug the javascript…. can anyone tell me why the links is not getting any li tags?? when i debug it with firebug the links variable remains empty.
Thanks