感觉这个用jQuery写挺简单的啊。 用js反而麻烦。 jQuery是个好东西啊。 以前就想做这种样式的选项卡但是不会css设置。 谢谢老师。
2017-05-25
最新回答 / shibor
list[i].className = '';这里应该是 list[j].className = '';是j不是i,目的是把所有li的className去掉。
2017-05-25
最新回答 / 慕粉201702
<!doctype html><html><head> <meta charset="UTF-8"><title>Document</title><style type="text/css"> *{margin:0; padding:0; font-size:13px; list-style:none;}.menu{width:210px; margin:50px auto; ...
2017-05-19
个人觉得,你要是不喜欢这个老师讲课的风格,你可以去看其他老师的课程,慕课网上那么多的课程,总有一款适合你的吧,何必要向老师发泄你的垃圾情绪、甚至人身攻击?分享是美德,尊重分享,尊重劳动。
2017-05-18
window.onload = function() {
var wrap = document.getElementById('wrap'),
pic = document.getElementById('pic'),
lists = document.getElementById('list').getElementsByTagName('li'),
index = 0,
timer = null;
window.clearInterval(timer);
timer = null;
timer = window.setInterval(autoPlay, 1000);
var wrap = document.getElementById('wrap'),
pic = document.getElementById('pic'),
lists = document.getElementById('list').getElementsByTagName('li'),
index = 0,
timer = null;
window.clearInterval(timer);
timer = null;
timer = window.setInterval(autoPlay, 1000);
2017-05-17
for(var i = 0; i < lists.length; i++) {
lists[i].id = i;
lists[i].onclick = function() {
changePic(this.id);
}
}
wrap.onmouseover = function() {
window.clearInterval(timer);
timer = null;
}
wrap.onmouseout = function() {
timer = window.setInterval(autoPlay, 1000);
}
lists[i].id = i;
lists[i].onclick = function() {
changePic(this.id);
}
}
wrap.onmouseover = function() {
window.clearInterval(timer);
timer = null;
}
wrap.onmouseout = function() {
timer = window.setInterval(autoPlay, 1000);
}
2017-05-17
function autoPlay() {
index++;
if(index >= lists.length) {
index = 0;
}
changePic(index);
}
function changePic(curIndex) {
for(var j = 0; j < lists.length; j++) {
lists[j].className = "";
}
lists[curIndex].className = "on";
pic.style.top = -(curIndex * 170) + "px";
index = curIndex;
}
}
index++;
if(index >= lists.length) {
index = 0;
}
changePic(index);
}
function changePic(curIndex) {
for(var j = 0; j < lists.length; j++) {
lists[j].className = "";
}
lists[curIndex].className = "on";
pic.style.top = -(curIndex * 170) + "px";
index = curIndex;
}
}
2017-05-17
send.onclick = function() {
timer=window.setInterval(function() {
times--;
if(times <= 0) {
send.disabled = false;
send.value = "发送验证码";
times = 60;
window.clearInterval(timer);
timer = null;
} else {
send.value = times + "秒后重试";
send.disabled = true;
}
}, 1000);
}
timer=window.setInterval(function() {
times--;
if(times <= 0) {
send.disabled = false;
send.value = "发送验证码";
times = 60;
window.clearInterval(timer);
timer = null;
} else {
send.value = times + "秒后重试";
send.disabled = true;
}
}, 1000);
}
for(var i = 0; i < _p.length; i++) {
_p[i].id = i;
_p[i].onclick = function() {
if(_ul[this.id].style.display == "" || _ul[this.id].style.display == "none") {
_ul[this.id].style.display = "block";
} else {
_ul[this.id].style.display = "none";
}
}
}
}
_p[i].id = i;
_p[i].onclick = function() {
if(_ul[this.id].style.display == "" || _ul[this.id].style.display == "none") {
_ul[this.id].style.display = "block";
} else {
_ul[this.id].style.display = "none";
}
}
}
}