我在解决如何解决IE中的getElementsByClassName问题时遇到了问题.我如何最好地实现罗伯特·尼曼(不能发布链接,因为我的代表只有1)解析到我的代码?或者jquery解决方案会更好吗?我的代码是
function showDesc(name) {
var e = document.getElementById(name);
//Get a list of elements that have a class name of service selected
var list = document.getElementsByClassName("description show");
//Loop through those items
for (var i = 0; i < list.length; ++i) { 
    //Reset all class names to description
    list[i].className = "description";
}
if (e.className == "description"){
    //Set the css class for the clicked element
    e.className += " show";
}
else{
    if (e.className == "description show"){
        return;
    }
}}
Run Code Online (Sandbox Code Playgroud)
我在此页面dev.msmnet.com/services/practice-management上使用它来显示/隐藏每项服务的描述(适用于Chrome和FF).任何提示将非常感谢.