function $(d){
return document.getelementbyid(d);
}
// set or get the current display style of the div
function dsp(d,v){
if(v==undefined){
return d.style.display;
}else{
d.style.display=v;
}
}
// set or get the height of a div.
function sh(d,v){
// if you are getting the height then display must be block to return the absolute height
if(v==undefined){
if(dsp(d)!='none'&& dsp(d)!=''){
return d.offsetheight;
}
viz = d.style.visibility;
d.style.visibility = 'hidden';
o = dsp(d);
dsp(d,'block');
r = parseint(d.offsetheight);
dsp(d,o);
d.style.visibility = viz;
return r;
}else{
d.style.height=v;
}
}
/*
* variable 's' defines the speed of the accordian
* variable 't' defines the refresh rate of the accordian
*/
s=7;
t=10;
//collapse timer is triggered as a setinterval to reduce the height of the div exponentially.
function ct(d){
d = $(d);
if(sh(d)>0){
v = math.round(sh(d)/d.s);
v = (v<1) ? 1 :v ;
v = (sh(d)-v);
sh(d,v+'px');
d.style.opacity = (v/d.maxh);
d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
}else{
sh(d,0);
dsp(d,'none');
clearinterval(d.t);
}
}
//expand timer is triggered as a setinterval to increase the height of the div exponentially.
function et(d){
d = $(d);
if(sh(d)<d.maxh){
v = math.round((d.maxh-sh(d))/d.s);
v = (v<1) ? 1 :v ;
v = (sh(d)+v);
sh(d,v+'px');
d.style.opacity = (v/d.maxh);
d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');';
}else{
sh(d,d.maxh);
clearinterval(d.t);
}
}
// collapse initializer
function cl(d){
if(dsp(d)=='block'){
clearinterval(d.t);
d.t=setinterval('ct("'+d.id+'")',t);
}
}
//expand initializer
function ex(d){
if(dsp(d)=='none'){
dsp(d,'block');
d.style.height='0px';
clearinterval(d.t);
d.t=setinterval('et("'+d.id+'")',t);
}
}
// removes classname from the given div.
function cc(n,v){
s=n.classname.split(/\s+/);
for(p=0;p<s.length;p++){
if(s[p]==v+n.tc){
s.splice(p,1);
n.classname=s.join(' ');
break;
}
}
}
//accordian initializer
function accordian(d,s,tc){
// get all the elements that have id as content
l=$(d).getelementsbytagname('div');
c=[];
for(i=0;i<l.length;i++){
h=l[i].id;
if(h.substr(h.indexof('-')+1,h.length)=='content'){c.push(h);}
}
sel=null;
//then search through headers
for(i=0;i<l.length;i++){
h=l[i].id;
if(h.substr(h.indexof('-')+1,h.length)=='header'){
d=$(h.substr(0,h.indexof('-'))+'-content');
d.style.display='none';
d.style.overflow='hidden';
d.maxh =sh(d);
d.s=(s==undefined)? 7 : s;
h=$(h);
h.tc=tc;
h.c=c;
// set the onclick function for each header.
h.onclick = function(){
for(i=0;i<this.c.length;i++){
cn=this.c[i];
n=cn.substr(0,cn.indexof('-'));
if((n+'-header')==this.id){
ex($(n+'-content'));
n=$(n+'-header');
cc(n,'__');
n.classname=n.classname+' '+n.tc;
}else{
cl($(n+'-content'));
cc($(n+'-header'),'');
}
}
}
if(h.classname.match(/selected+/)!=undefined){ sel=h;}
}
}
if(sel!=undefined){sel.onclick();}
}
">jb51.net,站长必备的高质量网页特效和广告代码。jb51.net,站长js特效。
网站首页
学院概况
- 广告代码
- 网页特效
专业设置
国际文凭课程
师生经典作品
在线视频
蒙妮坦精英学员
招生信息
咨询留言
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]