html焦点轮播图圆点居中,轮播图小圆点定位问题,不知道怎么动态运算,还望老师指点?...

body,ul{margin: 0; padding: 0;}

li{list-style: none;}

a{text-decoration: none;}

#back{width: 1600px; height: 700px; background: no-repeat; margin: 0 auto; position: relative;}

#back a{display: block; width: 60px; height: 60px; border: 10px solid #e97800; position: absolute; top: 310px;  -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; opacity: 0.6;}

#back a:hover{opacity: 0.9;}

#back img{width: 100%;}

#back ul{position: absolute; top: 630px; left: 50%;}

#back li {width: 30px; height: 30px; background: #CCC; -moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px; position: relative; float: left; margin-right: 10px;}

#back li img{width:200px; height: 90px; border: 5px solid #fff; position: absolute; top: -110px; left: -85px; display: none;}

.prev{left: 50px;}

.next{right: 50px;}

window.err= = function (){

var oBack = document.getElementById('back');

var aTab = oBack.getElementsByTagName('a');

var oUl = oBack.getElementsByTagName('ul')[0];

var aLi = oUl.getElementsByTagName('li');

var aImg = oUl.getElementsByTagName('img');

var num = 0;

var old = null;

var arrUrl = ['img/banner1.jpg','img/banner2.jpg','img/banner3.jpg']

for(var i=0;i

aTab[i].index = i;

aTab[i].err= = function (){

if (this.index == 0) {

num--;

if (num == -1) {

num = arrUrl.length-1;

}

oBack.style.background = 'url(' + arrUrl[num] +')'

} else{

num++;

if (num == arrUrl.length) {

num = 0;

}

oBack.style.background = 'url(' + arrUrl[num] +')'

}

}

}

for(var i=0;i

oUl.innerHTML += '

'%20+%20arrUrl%5Bi%5D%20+%20'';

aLi[i].style.left = -(15+i*arrUrl.length*30) + 'px';

// aLi[i].style.left = 1600/2-55+i*40 + 'px';

}

old = aLi[num];

for(var i=0;i

aLi[i].index = i;

aLi[i].err= = function (){

num = this.index;

aImg[num].style.display = 'block';

}

aLi[i].err= = function (){

num = this.index;

aImg[num].style.display = 'none';

}

aLi[i].err= = function (){

num = this.index;

old.style.background = ''

old = this;

oBack.style.background = 'url(' + arrUrl[num] +')'

aLi[this.index].style.background = '#FEA356'

}

}

function fnTab(){

oBack.style.background = 'url(' + arrUrl[num] +')'

aLi[num].style.background = '#FEA356'

}

fnTab();

}