第一个:
<script type="text/javascript">
window.onload=function(){
function Each(list, fun){
for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
};
var objs2 = keVar("idNum2").getElementsByTagName("li");
var tv2 = new TransformView("idTransformView2", "idSlider2", 300, tpz, {
onStart: function(){ Each(objs2, function(o, i){ o.className = tv2.Index == i ? "on" : ""; }) },//按钮样式
Up: false
});//6是轮播总数
tv2.Start();
Each(objs2, function(o, i){
o.onmouseover = function(){
o.className = "on";
tv2.Auto = false;
tv2.Index = i;
tv2.Start();
}
o.onmouseout = function(){
o.className = "";
tv2.Auto = true;
tv2.Start();
}
})
}
第二个:
window.onload = function()
{
var oDiv = document.getElementById('playBox');
var oPre = getByClass(oDiv,'pre')[0];
var oNext = getByClass(oDiv,'next')[0];
var oUlBig = getByClass(oDiv,'oUlplay')[0];
var aBigLi = oUlBig.getElementsByTagName('li');
var oDivSmall = getByClass(oDiv,'smalltitle')[0]
var aLiSmall = oDivSmall.getElementsByTagName('li');
function tab()
{
for(var i=0; i<aLiSmall.length; i++)
{
aLiSmall[i].className = '';
}
aLiSmall[now].className = 'thistitle'
startMove(oUlBig,'left',-(now*aBigLi[0].offsetWidth))
}
var now = 0;
for(var i=0; i<aLiSmall.length; i++)
{
aLiSmall[i].index = i;
aLiSmall[i].onclick = function()
{
now = this.index;
tab();
}
}
oPre.onclick = function()
{
now--
if(now ==-1)
{
now = aBigLi.length;
}
tab();
}
oNext.onclick = function()
{
now++
if(now ==aBigLi.length)
{
now = 0;
}
tab();
}
var timer = setInterval(oNext.onclick,3000) //滚动间隔时间设置
oDiv.onmouseover = function()
{
clearInterval(timer)
}
oDiv.onmouseout = function()
{
timer = setInterval(oNext.onclick,3000) //滚动间隔时间设置
}
}
咿呀咿呀哒哒