如何检查变量是否大于其他多个变量?

时间:2016-04-11 04:03:49

标签: javascript html

我需要检查变量是否大于4个其他变量。 有没有办法做到这一点? 到目前为止我已经尝试了

if(Guitar > Percussion || Brass || Keyboard || Woodwind)
            {
            var guitarpage = document.getElementById("GuitarPage");
            guitarpage.style.display ="block";
            }

        if(Percussion > Guitar || Brass || Keyboard || Woodwind) 
            {
            var percussionpage = document.getElementById("PercussionPage");
            percussionpage.style.display ="block";

            }

        if(Brass > Percussion || Guitar || Keyboard || Woodwind) {
            var brasspage = document.getElementById("BrassPage");
            brasspage.style.display ="block";
            }

        if(Keyboard > Percussion || Guitar || Brass || Woodwind) {
            var keyboardpage = document.getElementById("KeyboardPage");
            keyboardpage.style.display ="block";
            }

        if(Woodwind > Percussion || Guitar || Keyboard || Brass) {
            var woodpage = document.getElementById("WoodwindPage");
            woodpage.style.display ="block";
    }

以及使用&&但我要么显示每个div,要么根本不显示。

0 个答案:

没有答案