效果js
//<![CDATA[
//AUTHOR:JULLYCAT(ZHANGYANJUN)
/**获取DOM中id
* @param {object} id 获取的id值
*/$=function(id){
return document.getElementById(id);
}/**自定义多重类对象
* @param {Object} namespace 自定义类名
*/
Namespace = new Object();
Namespace.register = function(namespace){
var nsArray = namespace.split('.');
var sEval = "";
var sNS = "";
for (var i = 0; i < nsArray.length; i++){
if (i != 0) sNS += ".";
sNS += nsArray[i];
sEval += "if (typeof(" + sNS + ") == 'undefined') " + sNS + " = new Object();"
}
if (sEval != "") eval(sEval);
}/**
* 对数组Array对象扩展unite方法;
* @method unite 类似concat,但FF不支持concat;
* @param (arg) arg是需要增加的数组对象;
*/
Array.prototype.unite = function(arg){
var temparg = new Array();
var len1 = this.length;
var len2 = arg.length;
for(var i=0;i<(len1+len2);i++){
if(i<len1) this[i] = this[i];
else this[i] = arg[i-len1];
}
return this;
}/**
* 给数组扩展add方法.
* @method add 类似push,需要增加的元素同元数组进行比较,如果没有相同值则追加,如果有则不追加;
* @param {Object} obj 需要add的对象.
*/
Array.prototype.add = function(obj){
var add_flag = true;
for(var i=0;i<this.length;i++){
if(this[i]==obj){
add_flag = false;
break;
}
}
if(add_flag==true){
this[this.length] = obj;
}
}//]]>
//<![CDATA[
//AUTHOR:JULLYCAT(ZHANGYANJUN)Namespace.register("Para.widget.cookie");
Namespace.register("Para.widget.movebox");
Namespace.register("Para.util.setDiv");
Namespace.register("Para.util.move");
Namespace.register("Para.util.showDiv");
Namespace.register("Para.util.hotClass");
Namespace.register("Para.widget.hotword");
/**
*应用类方法定义
*/
(function(){
Para.widget.cookie = {
/**
* 新增或者修改cookie.
* @param {Object} name cookie名.
* @param {Object} value cookie值.
* @param {Object} time 有效时间单位为毫秒.
*/
newAndModif:function(name,value,time){
if(time!=null&&this.time!=''){
document.cookie = name+"="+value+"; expires="+this.createTime(time)+";";
}else{
document.cookie = name+"="+value+"; expires=Fri, 31 Dec 2100 23:59:59 GMT;";
}
},
/**
* 创建cookie的有效时间.
* @param {Object} time
*/
createTime:function(time){
var nowTime = new Date();
time = parseInt(time)*24*60*60*1000 + parseInt(nowTime.getTime());
var needTime = new Date(time);
return needTime.toGMTString();
},
getValue:function(name){
if(document.cookie != null){
var cookieStrArr = document.cookie.split("; ");
for(var i=0;i<cookieStrArr.length;i++){
if(cookieStrArr[i].split("=")[0]==name){
return cookieStrArr[i].split("=")[1];
}
}
}else{
return null;
}
}
}
})();/*
*
*
*/
(function(){Para.util.hotClass = {
/*@method initAttention(),初始化热词展现区域及a对象的事件
*@param (cookie的前缀名,需要获取热词的父级id,热词显示区父级id,热词显示区的id,需要获取热词的上级tagName,显示热词的最大个数)
*/
concat : function(arg1,arg2){
var arg = new Array();
var len1 = arg1.length;
var len2 = arg2.length;
for(var i=0;i<(len1+len2);i++){
if(i<len1) arg[i] =arg1[i];
else arg[i] = arg2[i-arg1.length];
}
arg1 = arg
return arg1;
},
initAttention:function(cookiename,mainbox,disbox,conbox,tagName,max){
var curObj = this;
var parCodes;
var childCodes = new Array;
var temparr1=new Array,temparr2 = new Array;
var hotwords = new Array();
if(Para.widget.cookie.getValue(cookiename) != null){
var hotwords = curObj.getCookievalue(cookiename);
curObj.getAttention(hotwords,conbox);
}else{
$(disbox).style.display = "none";
}
parCodes = $(mainbox).getElementsByTagName(tagName);
for(var i=0;i<parCodes.length;i++){
temparr = parCodes[i].getElementsByTagName("A");
childCodes = this.concat(childCodes,temparr);
}
for(var j=0;j<childCodes.length;j++){
childCodes[j].n = childCodes[j].childNodes[0].nodeValue;
childCodes[j].u = childCodes[j].href;
childCodes[j].onclick = function(){
var curhotwords = new Array();
curhotwords = curObj.getCookievalue(cookiename);
curObj.setAttention(cookiename,curhotwords,this.u,this.n,max);
}
}},
/*@method getCookievalue(),获取cookie值的后缀并返回Para.widget.hotword对象的数组
*@param (cookie的前缀名)
*/
getCookievalue:function(cookiename){
var word,hotword;
var hotwords = new Array();
if(Para.widget.cookie.getValue(cookiename)!=null){
var cookieValue = unescape(Para.widget.cookie.getValue(cookiename));
var wordarr = cookieValue.split("&");
for(var i=0;i<wordarr.length;i++){
word = wordarr[i].split("|");
hotword = new Para.widget.hotword(word[0],word[1]);
hotwords.push(hotword);
}
}
return hotwords;
},
/*@method setAttenttion(),获取最新热词
*@param (cookie的前缀名,最新热词数组,当前事件触发的对象,热词最大个数)
*/
setAttention:function(cookiename,arg,aurl,aword,max){
var hotwords = new Array;
var hotword = new Para.widget.hotword(aword,aurl);
var cookiestr = "";
var flag = true;
for(var i=0;i<arg.length;i++){
hotwords[i] = arg[i];
}
if ((hotwords.length<max) && (hotwords.length!=0))
{
for(var j=0;j<hotwords.length;j++){
if((hotwords[j].name == hotword.name) && (hotwords[j].url == hotword.url)){
//flag=false;
hotwords.splice(j,1);
}
}
//if(flag)
hotwords.unshift(hotword);
}else{
hotwords.push(hotword);
if(hotwords.length==max){
hotwords.shift();
}
}
for(var n=0;n<hotwords.length;n++){
cookiestr = cookiestr + hotwords[n].name + "|" + hotwords[n].url +"&"
}
cookiestr = escape(cookiestr.substring(0,cookiestr.length-1));
Para.widget.cookie.newAndModif(cookiename,cookiestr);
},
/*@method getAttention(),
*@param (最新热词数组,热词显示区域id)
*/
getAttention:function(arg,conbox){
var wordstr = "";
for(var j=0;j<arg.length;j++){
wordstr = wordstr + "<a href=\"" + arg[j].url + "\">" + arg[j].name + "</a> | ";
if (((j+1)%3 == 0) || (j==arg.length-1))
{
wordstr = wordstr.substring(0,wordstr.length-3);
wordstr = wordstr + "<br />";
}
}
$(conbox).innerHTML = wordstr;}
}
})();/*
*重构DIV位置的静态类
*@class setDiv
*/
(function(){
var initheight,totalheight;
Para.util.setDiv = {
/**
*初始化弹性显示DOM对象
*@method init
*@param (el,con,nums,overclassname,outclassname,speed,maxheight) tab前缀,显示内容前缀,tab个数,覆盖tab样式,离开tab样式,弹开速度,显示内容框高度
*/
init:function(el,con,nums,overclassname,outclassname,speed,maxheight){
var arg = new Array();
for(i=0;i<arguments.length;i++){
arg[i] = arguments[i];
}
for(j=1;j<=parseInt(arg[2]);j++){
tagBox = $(arg[0] + j);
hidBox = $(arg[1] + j);
tagBox.m = j;
hidBox.m = j;
tagBox.onmouseover=function(){Para.util.showDiv.slideshow(arg,this.m);};
tagBox.onmouseout=function(){Para.util.showDiv.slideshow(arg,this.m);};
hidBox.onmouseover=function(){Para.util.showDiv.slideshow(arg,this.m);};
//hidBox.onmouseout=function(){Para.util.showDiv.slideshow(arg,this.m);};
}
Para.util.showDiv.slideshow(arg,1);
},
/**
*构建移动DOM对象
*@method build
*@param (el,className,targetName) 父层对象,及移动对象使用的样式,移动对象的tagName
*/
build:function(el,className,targetName,cookiename,mspace,argAdArr,argAdTag,argAdCname){
totalheight = 0;
var ctrHeight;
var mb_arr = new Array();
var adTagArr = new Array();
var adParentArr = new Array();
var childtag = el.getElementsByTagName(targetName);
var adArr,adTag,adCname;
adArr = argAdArr;
adTag = argAdTag;
adCname = argAdCname;
for(i=0;i<childtag.length;i++){
if(childtag[i].className==className){
adParentArr.push(childtag[i]);
}
}
for(var n=0;n<adParentArr.length;n++){
//位置固定版块
if(adArr!=null && adTag!=null && adCname!=null){
adTagArr = adParentArr[n].getElementsByTagName(adTag);
for(var j=0;j<adTagArr.length;j++){
if(adTagArr[j].className == adCname){
adTagArr[j].innerHTML = adArr[n];
break;
}
}
}
//位置固定版块
with(adParentArr[n].style){
position = "absolute";
top = totalheight + "px";
}
if(adParentArr[n].scrollHeight==0) ctrHeight = parseInt(childtag[i].style.height);
else ctrHeight = adParentArr[n].scrollHeight;
if(mspace!=null && mspace!="") totalheight = totalheight + ctrHeight + mspace;
else totalheight = totalheight + ctrHeight;
mb_arr[mb_arr.length] = adParentArr[n].id;
}
el.style.height = totalheight + "px";
Para.util.move.init(el,mb_arr,cookiename);
},
/**
*获取cookie重置移动DOM对象
*@method rebuild
*@param (movebox,cookieValue) 父层对象,cookie截取后的字符
*/
rebuild:function(movebox,cookieValue,cookiename,mspace,argAdArr,argAdTag,argAdCname){
var ctrHeight;
var totalheight = 0;
var mb_arr = cookieValue.split("&");
var adTagArr = new Array();
var adArr,adTag,adCname;
adArr = argAdArr;
adTag = argAdTag;
adCname = argAdCname;
for(var i=0;i<mb_arr.length;i++){
//位置固定版块
if(adArr!=null && adTag!=null && adCname!=null){
adTagArr = $(mb_arr[i]).getElementsByTagName(adTag);
for(var j=0;j<adTagArr.length;j++){
if(adTagArr[j].className == adCname){
adTagArr[j].innerHTML = adArr[i];
}
}
}
//位置固定版块
$(mb_arr[i]).style.position = "absolute";
$(mb_arr[i]).style.top = totalheight + "px";
if(parseInt($(mb_arr[i]).scrollHeight)==0) {ctrHeight = parseInt($(mb_arr[i]).style.height);}
else ctrHeight = $(mb_arr[i]).scrollHeight;
if(mspace!=null && mspace!="") totalheight = totalheight + ctrHeight + mspace;
else totalheight = totalheight + ctrHeight;
}
movebox.style.height = totalheight + "px";
Para.util.move.init(movebox,mb_arr,cookiename);
},/**
*tab效果DOM对象初始化
*@method tabDivinit
*@param (nums,tab,con,curClassName,speed,oEvent) tab个数,tab前缀,显示内容前缀,tab当前时的样式,切换速度,设置控制切换的事件,tab非当前样式
*/
tabDivinit:function(nums,tab,con,curClassName,speed,oEvent,outcname){
var t = oEvent;
var arg = new Array;
for(i=0;i<arguments.length;i++){
arg[i] = arguments[i];
}
for(var j=0;j<arg[0];j++){
var curtab = $(arg[1] + j);
curtab.n = j;
switch(t){
case 'click':
curtab.onclick = function(){Para.util.showDiv.show(arg,this.n);};
break;
default:
curtab.onmouseover = function(){Para.util.showDiv.show(arg,this.n);};
break;
}
}
return arg;
}
};
})();/**
*显示隐藏类
*@class showDiv
*/
(function(){
var pos;
var showpos;
Para.util.showDiv = {
/**
*tab切换控制,切屏事件可设置
*@param arg是数组类,id为当前出发对象的编号
*/
show:function(arg,id){
var curtab,curobj;
curobj = this;
var useArg = new Array;
for(j=0;j<arg.length;j++){
useArg[j] = arg[j];
}
for(var i=0;i<useArg[0];i++){
curtab = $(useArg[1] +i);
if(i==id){
curtab.className = useArg[3];
$(useArg[2]+i).style.display = "block";
}else{
curtab.className = useArg[6];
$(useArg[2]+i).style.display = "none";
}
}
},/**
*tab自动切换控制,切屏事件自动设置
*@param arg是数组类
*/
autoshow:function(arg){
var time1,curobj,curtab,curnum,bpos;
curnum = 1;
curobj = this;
bpos = 0;
var useArg = new Array;
for(j=0;j<arg.length;j++){
useArg[j] = arg[j];
}
this.show(useArg,0);
function ctrl(){
time1 = setInterval(function(){
if(curnum>=useArg[0]) curnum=0;
bpos = curnum;
curobj.show(useArg,curnum);
curnum++;
},useArg[4])
}
ctrl();
for(var i=0;i<useArg[0];i++){
curtab = $(useArg[1] +i);
switch(useArg[5]){
case 'click':
curtab.onclick = function(){curobj.show(useArg,this.n);};
curtab.onmouseover = function(){clearInterval(time1);bpos=this.n;}
break;
default:
curtab.onmouseover = function(){clearInterval(time1);curobj.show(useArg,this.n);bpos=this.n;};
break;
}
$(useArg[2] +i).onmouseover = function(){clearInterval(time1);bpos++;}
$(useArg[2] +i).onmouseout = function(){
//bpos++;
//if(bpos==useArg[0]) bpos=0;
//curobj.show(useArg,bpos);
curnum = bpos;
ctrl();
}
curtab.onmouseout = function(){
//if(bpos==useArg[0]) bpos=0;
//curobj.show(useArg,bpos);
curnum = bpos;
ctrl();
}
}
},
/**
*由onmouseover和onmouseout事件触发,弹性显示
*@param arg是数组类,id是tab的后缀数字
*/
slideshow:function(arg,id){
var curobj = new Array();
for(j=0;j<arg.length;j++){
curobj[j] = arg[j];
}
var tagBox,hidBox;
var ctrl = 0;
if((id!=pos)||(pos==null)){
for(i=1;i<=parseInt(curobj[2]);i++){
tagBox = $(curobj[0] + i);
hidBox = $(curobj[1] + i);
if(i==id){
pos=id;
tagBox.className = curobj[3];
hidBox.style.display = "block";
/*设置弹性效果
//hidBox.style.overflow = "hidden";
//hidBox.style.height = "0px";
//var time1 = setInterval(function(){
//var ids = id;
//ctrl +=curobj[5];
//if(ctrl>curobj[6]) {
//clearInterval(time1);
//ctrl = curobj[6];
//}
//$(curobj[1] + ids).style.height = ctrl + "px";
//},30);
*/
hidBox.style.height = curobj[6] + "px";
}else{
hidBox.style.height = "0px";
tagBox.className = curobj[4];
hidBox.style.display = "none";
}
}
}
}}
})();/**
*移动类
*@class move
*/
(function(){
var movebox = null;
var moveboxs = new Array();
var oStart,oEnd,oStartY,oEndY,oStartAdH,oEndAdH;
var speed = 50;
var mflag = true;
Para.util.move = {
/**
*增加movebox对象
*@param id 移动层的父层
*@param 移动层id
*/
init:function(id,mb_arr,cookiename){var movebox = new Para.widget.movebox(id);
for(var i=0;i<mb_arr.length;i++){
movebox.list.push($(mb_arr[i]));
}
movebox.cookieid = cookiename;
moveboxs.push(movebox);
},/**
* 向上移动当前对象在整个对象中的位置,并交换互相的位置.
* @method moveUp
* @param {Object} m_b movebox的DOM对象.
* @param {Object} now 当前准备移动的DOM对象,包含在m_b里面.
*/
moveUp:function(m_b,now,argAdTag,argAdCname){
if(mflag){
oStart=null;
oEnd=null;
oStartY=null;
oEndY=null;
var changepoint = new Array();
var oStartAdObj,oEndAdObj;
movebox = this.isHave(m_b);
if(this.getUp(now)!=null){
changepoint = this.getUp(now);
oStart = changepoint[0];
oEnd = changepoint[1];
if(argAdTag!=null && argAdCname!=null){
oStartAdObj = this.getAdCon(oStart,argAdTag,argAdCname);
oEndAdObj = this.getAdCon(oEnd,argAdTag,argAdCname);
oStartAdObj[0].innerHTML = oEndAdObj[1];
oEndAdObj[0].innerHTML = oStartAdObj[1];
oStartAdH = oStartAdObj[2];
oEndAdH = oEndAdObj[2];
}
oStartY = parseInt(oEnd.style.top);
oEndY = parseInt(oStart.style.top);
oStart.style.zIndex = "0";
oEnd.style.zIndex = "360";
oStart.style.filter="alpha(opacity=10)";
this.startmoving();
this.endmoving();
oStart.style.filter="alpha(opacity=100)";
this.change(oEnd,oStart);
}
Para.widget.cookie.newAndModif(movebox.cookieid,this.toString(),30);
}},
/**
*向下移动当前对象在整个对象中的位置,并交换互相的位置.
*@method moveDown
*/
moveDown:function(m_b,now,argAdTag,argAdCname){
if(mflag){
oStart=null;
oEnd=null;
oStartY=null;
oEndY=null;
var changepoint = new Array();
var oStartAdObj,oEndAdObj;
adTag = argAdTag;
adCname = argAdCname;
movebox = this.isHave(m_b);
if(this.getDown(now)!=null){
changepoint = this.getDown(now);
oStart = changepoint[0];
oEnd = changepoint[1];
if(argAdTag!=null && argAdCname!=null){
oStartAdObj = this.getAdCon(oStart,argAdTag,argAdCname);
oEndAdObj = this.getAdCon(oEnd,argAdTag,argAdCname);
oStartAdObj[0].innerHTML = oEndAdObj[1];
oEndAdObj[0].innerHTML = oStartAdObj[1];
oStartAdH = oStartAdObj[2];
oEndAdH = oEndAdObj[2];
}
oStartY = parseInt(oEnd.style.top);
oEndY = parseInt(oStart.style.top);
oStart.style.zIndex = "360";
oEnd.style.zIndex = "0";
oEnd.style.filter="alpha(opacity=10)";
this.startmoving();
this.endmoving();
oEnd.style.filter="alpha(opacity=100)";
this.change(oEnd,oStart);}
Para.widget.cookie.newAndModif(movebox.cookieid,this.toString(),30);
}},
getAdCon:function(el,argAdTag,argAdCname){
var adTagArr = el.getElementsByTagName(argAdTag);
var tempAdCon = new Array();
for(var j=0;j<adTagArr.length;j++){
if(adTagArr[j].className == argAdCname){
tempAdCon[0] = adTagArr[j];
tempAdCon[1] = adTagArr[j].innerHTML;
tempAdCon[2] = adTagArr[j].scrollHeight;
break;
}
}
return tempAdCon;
},
/**
*上一层的移动定位
*/
startmoving:function(){
var con = this;
yStart = parseInt(oStart.style.top);
yEnd = oStartY+(oEnd.scrollHeight-oStart.scrollHeight+(oEndAdH-oStartAdH));
if(yStart<yEnd){
this.moveY(oStart,1,speed,yEnd);
setTimeout(function(){con.startmoving()},1);
mflag = false;
}
if(yStart>yEnd){
this.moveY(oStart,2,speed,yEnd);
setTimeout(function(){con.startmoving()},1);
mflag = false;
}
if(yStart==yEnd){
mflag = true;
}
},
/**
*下一层移动定位
*/
endmoving:function(){
yStart = parseInt(oEnd.style.top);
yEnd = parseInt(oEndY);
var con = this;
if(yStart<yEnd){
this.moveY(oEnd,1,speed,yEnd);
setTimeout(function(){con.endmoving()},1);
mflag = false;
}
if(yStart>yEnd){
this.moveY(oEnd,2,speed,yEnd);
setTimeout(function(){con.endmoving()},1);
mflag = false;
}
if(yStart==yEnd){
mflag = true;
}
},
/**
*调整浮动层obj的top值
*@method moveY
*/
moveY:function(obj,ySpeenType,speed,yEnd){
if(ySpeenType==1){
if((parseInt(obj.style.top)+speed)>=yEnd){
obj.style.top = yEnd+"px";
}else{
obj.style.top = parseInt(obj.style.top)+speed+"px";
}
}
if(ySpeenType==2){
if((parseInt(obj.style.top)-speed)<=yEnd){
obj.style.top = yEnd+"px";
}else{
obj.style.top = parseInt(obj.style.top)-speed+"px";
}
}
},
/**
*获取移动对象在movebox对象list中的位置
*@method getIndex
*@param 移动对象
*/
getIndex:function(moveObj){
for(var i=0;i<movebox.list.length;i++){
if(movebox.list[i]==moveObj){
return i;
}
}
return -1;
},
/**
*获取moveboxs中movebox对象
*@param m_b是移动层的父层
*/
isHave:function(m_b){
for(var i=0;i<moveboxs.length;i++){
if(moveboxs[i].name==$(m_b.id)){
return moveboxs[i];
}
}
},
/**
* 向上获取当前对象的临近的对象.
* @method getUp
* @param {Object} now 当前对象.
*/
getUp:function(now){
var arrm = new Array();
for(var i=0;i<movebox.list.length;i++){
if(movebox.list[i]==now){
if(i>0){
arrm[0] = movebox.list[i-1];
arrm[1] = movebox.list[i];
return arrm;
}else{
return null;
}
}
}
},
/**
* 向下获取当前对象的临近的对象.
* @method getDown
* @param {Object} now 当前对象.
*/
getDown:function(now){
var arrm = new Array();
for(var i=0;i<movebox.list.length;i++){
if(movebox.list[i]==now){
if(i<movebox.list.length-1){
arrm[0] = movebox.list[i];
arrm[1] = movebox.list[i+1];
return arrm;
}else{
return null;
}
}
}
},
/**
*改变移动对象在movebox.list中的位置
*@method change
*@param (start,end)移动的两个对象
*/
change:function(start,end){
var s_index = this.getIndex(start);
var e_index = this.getIndex(end);
if(s_index!=-1&&e_index!=-1){
movebox.list[s_index] = end;
movebox.list[e_index] = start;
movebox.version++;
}
},
/**
*将movebox对象中的list数组值用&连接返回字符串
*@method toString
*/
toString:function(){
var tempStr = "";
for(var i=0;i<movebox.list.length;i++){
tempStr = tempStr + movebox.list[i].id + "&";
}
tempStr = tempStr.substring(0,tempStr.length-1);
return tempStr;
}
};
})();
/**
* 移动的组合类.
* @class movebox
* @param {Object} name 整个movebox的ID名称.
*/
Para.widget.movebox = function(name){
this.name = name;
this.list = new Array();
this.size = 0;
this.version = 0;
this.obj = null;
this.cookieid = null;
}Para.widget.hotword = function(name,url,cname){
this.name = name;
this.url = url;
this.cname = cname;
}
//]]>
// Author: Dakular
// Useage: HCmarquee(滚动对象id, 可见范围宽度, 可见范围高度, 滚动条数, 可见条数, 滚动速度, 停留时间, 方向); 方向有left和up两种
function HCmarquee(id,mw,mh,mr,sr,ms,pause){var obj=document.getElementById(id);
obj.ss=false; //stop tag
obj.mr=mr; //marquee rows
obj.sr=sr; //marquee display rows
obj.mw=mw; //marquee width
obj.mh=mh; //marquee height
obj.ms=ms; //marquee speed
obj.pause=pause; //pause time
obj.pt=0; //pre top
obj.st=0; //stop time
obj.mul=1;
obj.con="";
with(obj){
style.width=mw+"px";
style.height=mh+"px";
noWrap=false;
onmouseover=stopm;
onmouseout=startm;
scrollTop=0+"px";
scrollLeft=0+"px";
}if(obj.mr!=1){
obj.tt=mh*mr/sr;
obj.ct=mh; //current top
obj.innerHTML+=obj.innerHTML;
setInterval(scrollUp,obj.ms);
}
function scrollUp(){
if(obj.ss==true) return;
obj.ct+=1;
if(obj.ct==obj.mh+1){
obj.st+=1; obj.ct-=1;
if(obj.st==(obj.pause*obj.mul)){
obj.ct=0; obj.st=0;
if(obj.mul==1) obj.mul = 1;
else obj.mul = 1;
}
}else {
obj.pt=(++obj.scrollTop);
if(obj.pt==obj.tt){obj.scrollTop=0;}
}
}function stopm(){obj.ss=true;}
function startm(){obj.ss=false;}}
//]]>function checkchat(user_id)
{
var chaturl="http://chat.paratong.com/chat/chat.asp?worker_id="+user_id+"&IsState=0&LocationPre="+window.location.href;
var vra=document.createElement('a');
vra.target='_blank';
vra.href=chaturl;
document.body.appendChild(vra);
vra.click();
}function gradient(id) {
var oId = document.getElementById(id);
var tmp = 0;
var autoGra = setInterval(function() { tmp += 10; oId.style.opacity = tmp * .01; oId.style.filter = 'alpha(opacity=' + tmp + ')'; if (tmp >= 100) clearInterval(autoGra) }, 10)
}
function gradientHd(id) {
var oId = document.getElementById(id)
oId.style.opacity = 0;
oId.style.filter = 'alpha(opacity=0)';
}
/*
Name:ball changeTab
*/
function ballTab(ctrl, cntpre, cwrap, isAuto, timeout) {
var exhIndex = 0;
var autoBall = setInterval(changeTab, 7000);
if (timeout) {
clearInterval(autoBall);
setTimeout(function() { autoBall = setInterval(changeTab, 7000) }, 2300)
}
var exhCtrls = document.getElementById(ctrl).getElementsByTagName('span');
for (var i = 0; i < exhCtrls.length; i++) {
exhCtrls[i].onmouseover = function(i) {
return function() {
if (i == exhIndex) return;
exhCtrls[i].className = 'on';
exhCtrls[exhIndex].className = '';
document.getElementById(cntpre + i).style.visibility = 'visible';
gradient(cntpre + i);
document.getElementById(cntpre + exhIndex).style.visibility = 'hidden';
gradientHd(cntpre + exhIndex);
exhIndex = i;
}
} (i)
}
document.getElementById(ctrl).onmouseover = document.getElementById(cwrap).onmouseover = function() {
clearInterval(autoBall);
}
document.getElementById(ctrl).onmouseout = document.getElementById(cwrap).onmouseout = function() {
autoBall = setInterval(changeTab, 7000);
}
var ballNum = exhCtrls.length;
function changeTab() {
if (exhIndex >= ballNum-1 && !isAuto)
{
clearInterval(autoBall);
document.getElementById(ctrl).onmouseover = document.getElementById(cwrap).onmouseover = document.getElementById(ctrl).onmouseout = document.getElementById(cwrap).onmouseout = null;
}
exhCtrls[exhIndex].className = '';
exhCtrls[(exhIndex + 1) % ballNum].className = 'on';
document.getElementById(cntpre + exhIndex).style.visibility = 'hidden';
gradientHd(cntpre + exhIndex);
document.getElementById(cntpre + (exhIndex + 1) % ballNum).style.visibility = 'visible';
gradient(cntpre + (exhIndex + 1) % ballNum);
exhIndex++;
exhIndex %= ballNum;
}
}
posted on 2010-07-13 16:03 jianshaohui 阅读(755) 评论(0) 编辑 收藏 举报