同一个js效果,如何在同一个页面调用4次。如何实现。。。??、
js代码:<SCRIPT>function$(n){returndocument.getElementById(n)}varimg=$("largeImage").get...
js代码:<SCRIPT>
function $(n){return document.getElementById(n)}
var img = $("largeImage").getElementsByTagName("a");
var td = $("simg").getElementsByTagName("img");
var lilist = $("simg").getElementsByTagName("li");
var ttitle=$("jstitle").getElementsByTagName("span");
var now = 1;
var count = td.length; //设置数量
var def = 0; //默认显示
var speed1 = 6000; //3秒
//initialize
for(var i=0;i<count;i++){
//td
td[i].className = "focusaa";
lilist[i].className = "liaa";
//img
img[i].style.display = "none";
}
//set default
img[def].style.display = "block";
td[def].className = "focusbb";
lilist[def].className = "libb";
function setClass(n){
for(var i=0;i<count;i++)
{
td[i].className = "focusaa";
lilist[i].className = "liaa";
ttitle[i].className = "disnone";
}
ttitle[n].className = "";
td[n].className = "focusbb";
lilist[n].className = "libb";
}
function setImg(n){
try{
largeImage.filters[0].Apply();
for(var i=0;i<count;i++){
img[i].style.display = "none";
}
img[n].style.display = "block";
largeImage.filters[0].play();
}
catch(e){
for(var i=0;i<count;i++){
img[i].style.display = "none";
}
img[n].style.display = "block";
}
}
//contorl changed
function changeBart(n){
setClass(n);
setImg(n);
now= n+1;
}
var autot = '';
function setChanget(){
if(now<count){
changeBart(now);
}
else{
now = 0;
changeBart(now);
}
}
function setAutot(){autot = setInterval("setChanget()", speed1)}
function cAuto(){clearInterval(autot)}
setAutot();
</SCRIPT> 展开
function $(n){return document.getElementById(n)}
var img = $("largeImage").getElementsByTagName("a");
var td = $("simg").getElementsByTagName("img");
var lilist = $("simg").getElementsByTagName("li");
var ttitle=$("jstitle").getElementsByTagName("span");
var now = 1;
var count = td.length; //设置数量
var def = 0; //默认显示
var speed1 = 6000; //3秒
//initialize
for(var i=0;i<count;i++){
//td
td[i].className = "focusaa";
lilist[i].className = "liaa";
//img
img[i].style.display = "none";
}
//set default
img[def].style.display = "block";
td[def].className = "focusbb";
lilist[def].className = "libb";
function setClass(n){
for(var i=0;i<count;i++)
{
td[i].className = "focusaa";
lilist[i].className = "liaa";
ttitle[i].className = "disnone";
}
ttitle[n].className = "";
td[n].className = "focusbb";
lilist[n].className = "libb";
}
function setImg(n){
try{
largeImage.filters[0].Apply();
for(var i=0;i<count;i++){
img[i].style.display = "none";
}
img[n].style.display = "block";
largeImage.filters[0].play();
}
catch(e){
for(var i=0;i<count;i++){
img[i].style.display = "none";
}
img[n].style.display = "block";
}
}
//contorl changed
function changeBart(n){
setClass(n);
setImg(n);
now= n+1;
}
var autot = '';
function setChanget(){
if(now<count){
changeBart(now);
}
else{
now = 0;
changeBart(now);
}
}
function setAutot(){autot = setInterval("setChanget()", speed1)}
function cAuto(){clearInterval(autot)}
setAutot();
</SCRIPT> 展开
展开全部
你每隔1000ms调用一次就Ok了吧?
追问
不是,我的意思是一个效果,我要在一个页面的四个位置同时调用。。。如何实现/??
追答
调用同一个方法4次?还是不明白你的意思
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询