当前位置:编程学习 > JS >>

相册焦点图片切换效果代码

相册焦点图片切换效果代码
/*
文章提供一款js的相册焦点图片切换效果哦,使用方法就是把里面的#xx替换你相对就的div li 就行了
*/
function imagefocus(){
 if(!$('image_focus')||!$('image_focus_big')||!$('image_focus_small')) return;
 var imagesmalllists= $('image_focus_small').getelementsbytagname('li');
 var imagebiglists= $('image_focus_big').getelementsbytagname('li');
 for(var i=0; i<imagesmalllists.length; i++){
  imagesmalllists[i].setattribute('nodeno',i);
 }
 for(var i=0; i<imagesmalllists.length; i++){
  imagesmalllists[i].onmouseo教程ver= function() {
   var n= this.getattribute('nodeno');
   for(var m=0; m<imagebiglists.length; m++){
    imagebiglists[m].classname=''; 
   }
   imagebiglists[n].classname='current';  
  }
 }
}
addloadevent(imagefocus);

function $(id) { return document.getelementbyid(id); }

function addloadevent(func){
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
  window.onload = func;
 } else {
  window.onload = function(){
   oldonload();
   func();
  }
 }
}

</script>

补充:网页制作,js教程 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,