// 蔬菜报价栏 var MoreContainer = document.getElementsByClassName('more-container'); var BtnA = document.getElementsByClassName('btn-a'); var BtnDiv = document.getElementsByClassName('btn-div'); var Offer = document.getElementsByClassName('offer'); BtnA[0].onclick = function () { // BtnDiv[0].style.backgroundColor = 'rgba(62, 138, 74, 0.3)'; // BtnDiv[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnDiv[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnDiv[3].style.backgroundColor = 'rgb(38, 117, 212)'; // BtnA[0].style.backgroundColor = 'rgba(62, 138, 74, 0)'; // BtnA[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnA[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnA[3].style.backgroundColor = 'rgb(38, 117, 212)'; BtnA[0].style.borderLeft = '3px solid red'; BtnA[1].style.borderLeft = 'none'; BtnA[2].style.borderLeft = 'none'; BtnA[3].style.borderLeft = 'none'; BtnA[0].style.color = 'red'; BtnA[1].style.color = '#fff'; BtnA[2].style.color = '#fff'; BtnA[3].style.color = '#fff'; Offer[0].className = 'list-container offer parent'; Offer[1].className = 'no-display offer parent'; Offer[2].className = 'no-display offer parent'; Offer[3].className = 'no-display offer parent'; if (MoreContainer.length != 0) { MoreContainer[0].className = 'more-container'; MoreContainer[1].className = 'no-display more-container'; MoreContainer[2].className = 'no-display more-container'; MoreContainer[3].className = 'no-display more-container'; } } BtnA[1].onclick = function () { // BtnDiv[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnDiv[1].style.backgroundColor = 'rgba(254, 192, 69, 0.3)'; // BtnDiv[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnDiv[3].style.backgroundColor = 'rgb(38, 117, 212)'; // BtnA[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnA[1].style.backgroundColor = 'rgba(254, 192, 69, 0)'; // BtnA[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnA[3].style.backgroundColor = 'rgb(38, 117, 212)'; BtnA[0].style.borderLeft = 'none'; BtnA[1].style.borderLeft = '3px solid red'; BtnA[2].style.borderLeft = 'none'; BtnA[3].style.borderLeft = 'none'; BtnA[0].style.color = '#fff'; BtnA[1].style.color = 'red'; BtnA[2].style.color = '#fff'; BtnA[3].style.color = '#fff'; Offer[0].className = 'no-display offer parent'; Offer[1].className = 'list-container offer parent'; Offer[2].className = 'no-display offer parentparent'; Offer[3].className = 'no-display offer parent'; if (MoreContainer.length != 0) { MoreContainer[0].className = 'no-display more-container'; MoreContainer[1].className = 'more-container'; MoreContainer[2].className = 'no-display more-container'; MoreContainer[3].className = 'no-display more-container'; } } BtnA[2].onclick = function () { // BtnDiv[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnDiv[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnDiv[2].style.backgroundColor = 'rgba(202, 17, 25, 0.3)'; // BtnDiv[3].style.backgroundColor = 'rgb(38, 117, 212)'; // BtnA[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnA[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnA[2].style.backgroundColor = 'rgba(202, 17, 25, 0)'; // BtnA[3].style.backgroundColor = 'rgb(38, 117, 212)'; BtnA[0].style.borderLeft = 'none'; BtnA[1].style.borderLeft = 'none'; BtnA[2].style.borderLeft = '3px solid red'; BtnA[3].style.borderLeft = 'none'; BtnA[0].style.color = '#fff'; BtnA[1].style.color = '#fff'; BtnA[2].style.color = 'red'; BtnA[3].style.color = '#fff'; Offer[0].className = 'no-display offer parent'; Offer[1].className = 'no-display offer parent'; Offer[2].className = 'list-container offer parent'; Offer[3].className = 'no-display offer parent'; if (MoreContainer.length != 0) { MoreContainer[0].className = 'no-display more-container'; MoreContainer[1].className = 'no-display more-container'; MoreContainer[2].className = 'more-container'; MoreContainer[3].className = 'no-display more-container'; } } BtnA[3].onclick = function () { // BtnDiv[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnDiv[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnDiv[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnDiv[3].style.backgroundColor = 'rgba(38, 117, 212, 0.3)'; // BtnA[0].style.backgroundColor = 'rgb(62, 138, 74)'; // BtnA[1].style.backgroundColor = 'rgb(254, 192, 69)'; // BtnA[2].style.backgroundColor = 'rgb(202, 17, 25)'; // BtnA[3].style.backgroundColor = 'rgba(38, 117, 212, 0)'; BtnA[0].style.borderLeft = 'none'; BtnA[1].style.borderLeft = 'none'; BtnA[2].style.borderLeft = 'none'; BtnA[3].style.borderLeft = '3px solid red'; BtnA[0].style.color = '#fff'; BtnA[1].style.color = '#fff'; BtnA[2].style.color = '#fff'; BtnA[3].style.color = 'red'; Offer[0].className = 'no-display offer parent'; Offer[1].className = 'no-display offer parent'; Offer[2].className = 'no-display offer parent'; Offer[3].className = 'list-container offer parent'; if (MoreContainer.length != 0) { MoreContainer[0].className = 'no-display more-container'; MoreContainer[1].className = 'no-display more-container'; MoreContainer[2].className = 'no-display more-container'; MoreContainer[3].className = 'more-container'; } }