0

下面是我的代码。它应该过滤一个表。它在除 IE 之外的所有应用中都运行良好。你能帮我吗?

也许缺少标签或其他东西。我已经经历过很多次了,真的可以请人帮忙!

<script type="text/javascript">
function hasPath(element, cls) {
    return (' ' + element.getAttribute('pathway')).indexOf(cls) > -1;
}

function hasLevel(element, cls) {
    return (' ' + element.getAttribute('level')).indexOf(cls) > -1;
}

function hasBody(element, cls) {
    return (' ' + element.getAttribute('body')).indexOf(cls) > -1;
}

function QualificationSearch() {
    var imgdiv = document.getElementById("Chosen_Pathway_img");
    var p = document.getElementById("PathwaySelect");
    var pathway = p.options[p.selectedIndex].value;
    if (pathway == "ALLPATHS") {
        pathway = "";
        imgdiv.src = "/templates/superb/images/QualChecker/pic_0.png"
    }
    if (pathway == "ES") {
        imgdiv.src = "/templates/superb/images/QualChecker/pic_1.png"
    }
    if (pathway == "HOUSING") {
        imgdiv.src = "/templates/superb/images/QualChecker/pic_2.png"
    }
    if (pathway == "PLAYWORK") {
        imgdiv.src = "/templates/superb/images/QualChecker/pic_3.png"
    }
    if (pathway == "SC") {
        imgdiv.src = "/templates/superb/images/QualChecker/pic_4.png"
    }
    if (pathway == "YW") {
        imgdiv.src = "/templates/superb/images/QualChecker/pic_5.png"
    }
    var a = document.getElementById("AwardingBodySelect");
    var awardingBody = a.options[a.selectedIndex].value;
    if (awardingBody == "ALLBODIES") {
        awardingBody = "";
    }
    var levelGroup = document.getElementsByName("LevelGroup");
    var chosenLevel = ""
    for (var g = 0; g < levelGroup.length; g++) {
        if (levelGroup[g].checked) {
            chosenLevel += levelGroup[g].value + " ";
        }
    }
    if (chosenLevel == undefined) {
        var chosenLevel = "";
    } else {
        var splitLevel = chosenLevel.split(" ");
        var levelA = splitLevel[0];
        var levelB = splitLevel[1];
        var levelC = splitLevel[2];
        var levelD = splitLevel[3];
        if (levelA == "") {
            levelA = "NOLVL"
        }
        if (levelB == "") {
            levelB = "NOLVL"
        }
        if (levelC == "") {
            levelC = "NOLVL"
        }
        if (levelD == "") {
            levelD = "NOLVL"
        }
    }
    var fil = document.getElementsByName("QList");
    for (var i = 0; i < fil.length; i++) {
        fil.item(i).style.display = "none";
        if ((hasBody(fil.item(i), awardingBody) == true || awardingBody == "") && (hasPath(fil.item(i), pathway) == true || pathway == "") && ((hasLevel(fil.item(i), levelA) == true || hasLevel(fil.item(i), levelB) == true || hasLevel(fil.item(i), levelC) == true || hasLevel(fil.item(i), levelD) == true) || chosenLevel == "")) {
            fil.item(i).style.display = "block";
        }
    }
}
</script>
4

1 回答 1

0

检查你的分号。IE 在这类东西上比 FF 严格得多。

于 2012-04-20T17:02:34.060 回答