js

万年历

var lis = document.getElementsByClassName('li-1');

var a = document.getElementById('post');

var a1 = document.getElementById('post2');

for(var i = 0; i < lis.length; i++) {

lis[0].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '一月'

a1.innerHTML = '一月'

}

lis[0].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[1].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '二月'

a1.innerHTML = '二月'

}

lis[1].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[2].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '三月'

a1.innerHTML = '三月'

}

lis[2].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[3].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '四月'

a1.innerHTML = '四月'

}

lis[3].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[4].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '五月'

a1.innerHTML = '五月'

}

lis[4].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[5].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '六月'

a1.innerHTML = '六月'

}

lis[5].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

lis[6].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '七月'

a1.innerHTML = '七月'

}

lis[6].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[7].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '八月'

a1.innerHTML = '八月'

}

lis[7].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[8].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '九月'

a1.innerHTML = '九月'

}

lis[8].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[9].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '十月'

a1.innerHTML = '十月'

}

lis[9].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[10].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '十一月'

a1.innerHTML = '十一月'

}

lis[10].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

}

//end

lis[11].onmouseover = function() {

this.style.background = '#fff';

this.children[0].style.color = '#000';

this.children[1].style.color = '#000';

a.innerHTML = '十二月'

a1.innerHTML = '十二月'

}

lis[11].onmouseout = function() {

this.style.background = '';

this.children[0].style.color = '#fff';

this.children[1].style.color = '#fff';

a.innerHTML = ''

a1.innerHTML = ''

} //end

}

你可能感兴趣的:(js)