function addfavorite(surl,stitle) { try{ window.external.addfavorite(surl, stitle); } catch (e){ try{ window.sidebar.addpanel(stitle, surl, ""); } catch (e){ alert("加入收藏失败,请使用ctrl+d进行添加"); } } } /* * 设为主页 */ function addhome(surl) { if (window.sidebar) { try { netscape.security.privilegemanager.enableprivilege("universalxpconnect"); } catch (e){ alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为true"); } var prefs = components.classes["@mozilla.org/preferences-service;1"].getservice( components.interfaces.nsiprefbranch ); prefs.setcharpref("browser.startup.homepage",surl); }else if(document.all){ document.body.style.behavior="url(#default#homepage)"; document.body.sethomepage(surl); } } /*收藏*/ function collection(type,obj_id){ $.ajax({ type: "post", url: "member/collection.php", data:"cmd=collection&type="+type+"&obj_id="+obj_id, success: function(msg){ alert(msg); } }); } /* * ajax 取得广告 */ function getadver(url,place,return_div){ $.ajax({ type: "post", url: url, data: "place="+place, success: function(msg){ $("#"+return_div).html(msg); } }); } /* * 幻灯片 * */ function imagemovie(){ this.width=100; this.height=100; this.textheight=20; this.flashheight=0; this.pics=''; this.links=''; this.texts=''; this.add=function(pic,link,text){ if(this.pics!='')this.pics+='|'; this.pics+=pic; if(this.links!='')this.links+='|'; this.links+=link; if(this.texts!='')this.texts+='|'; this.texts+=text; } this.play = function(){ this.flashheight=this.height + this.textheight; document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); } } /* * 选项卡 * */ opcard = function() { this.bind = new array(); this.index = 0; //默认显示哪个选项卡,从0开始 this.style = new array(); //["","",""] this.overstyle = false; //选项是否有over, out变换样式事件,样式为this.style[2] this.overchange = false; //内容是否用over, out直接激活 this.menu = false; //菜单类型 this.nesting = [false,false,"1","1"]; //是否嵌套,后面2个参数是指定menu,info的子集深度所用id this.auto = [false, 1000]; //自动滚动[true,2000] this.timerid = null; //自动播放的 this.menutimerid = null; //菜单延时的 this.creat = function(func) { var _arrmenu = document.getelementbyid(this.bind[0]).getelementsbytagname(this.bind[1]); var _arrinfo = document.getelementbyid(this.bind[2]).getelementsbytagname(this.bind[3]); var my = this, i; var arglen = arguments.length; var arrm = new array(); if(this.nesting[0] || this.nesting[1]) // 有选项卡嵌套 { // 过滤出需要的数据 var arrmenu = this.nesting[0]?getchilds(_arrmenu,this.bind[0],2):_arrmenu; var arrinfo = this.nesting[1]?getchilds(_arrinfo,this.bind[2],3):_arrinfo; } else { var arrmenu = _arrmenu; var arrinfo = _arrinfo; } var l = arrmenu.length; if(l!=arrinfo.length){alert("菜单和内容必须拥有相同的数量\n如果需要,你可以放一个空的在那占位。")} // 修正 if(this.menu){this.auto=false;this.overchange=true;} //如果是菜单,则没有自动运行,有over, out直接激活 // 循环添加各个事件等 for(i=0;i= 7)this.start(); } marquee.prototype.start = function() { if(this.id == -1)return; if(this.waittime < 800)this.waittime = 800; if(this.timer < 20)this.timer = 20; if(this.width == 0)this.width = parseint(this.id.style.width); if(this.height == 0)this.height = parseint(this.id.style.height); if(typeof this.direction == "string")this.direction = this.directionarray[this.direction.tostring().tolowercase()]; this.halfwidth = math.round(this.width / 2); this.halfheight = math.round(this.height / 2); this.bakstep = this.step; this.id.style.width = this.width + "px"; this.id.style.height = this.height + "px"; if(typeof this.scrollstep != "number")this.scrollstep = this.direction > 1 ? this.width : this.height; var templateleft = "
msclass_temp_htmlmsclass_temp_html
"; var templatetop = "
msclass_temp_html
msclass_temp_html
"; var msobj = this; msobj.temphtml = msobj.id.innerhtml; if(msobj.direction <= 1) { msobj.id.innerhtml = templatetop.replace(/msclass_temp_html/g,msobj.id.innerhtml); } else { if(msobj.scrollstep == 0 && msobj.delaytime == 0) { msobj.id.innerhtml += msobj.id.innerhtml; } else { msobj.id.innerhtml = templateleft.replace(/msclass_temp_html/g,msobj.id.innerhtml); } } var timer = this.timer; var delaytime = this.delaytime; var waittime = this.waittime; msobj.startid = function(){msobj.scroll()} msobj.continue = function() { if(msobj.mouseover == 1) { settimeout(msobj.continue,delaytime); } else { clearinterval(msobj.timerid); msobj.ctl = msobj.stop = 0; msobj.timerid = setinterval(msobj.startid,timer); } } msobj.pause = function() { msobj.stop = 1; clearinterval(msobj.timerid); settimeout(msobj.continue,delaytime); } msobj.begin = function() { msobj.clientscroll = msobj.direction > 1 ? msobj.id.scrollwidth / 2 : msobj.id.scrollheight / 2; if((msobj.direction <= 1 && msobj.clientscroll <= msobj.height + msobj.step) || (msobj.direction > 1 && msobj.clientscroll <= msobj.width + msobj.step)) { msobj.id.innerhtml = msobj.temphtml; delete(msobj.temphtml); return; } delete(msobj.temphtml); msobj.timerid = setinterval(msobj.startid,timer); if(msobj.scrollstep < 0)return; msobj.id.onmousemove = function(event) { if(msobj.scrollstep == 0 && msobj.direction > 1) { var event = event || window.event; if(window.event) { if(msobj.isnotopera) { msobj.eventleft = event.srcelement.id == msobj.id.id ? event.offsetx - msobj.id.scrollleft : event.srcelement.offsetleft - msobj.id.scrollleft + event.offsetx; } else { msobj.scrollstep = null; return; } } else { msobj.eventleft = event.layerx - msobj.id.scrollleft; } msobj.direction = msobj.eventleft > msobj.halfwidth ? 3 : 2; msobj.abscenter = math.abs(msobj.halfwidth - msobj.eventleft); msobj.step = math.round(msobj.abscenter * (msobj.bakstep*2) / msobj.halfwidth); } } msobj.id.onmouseover = function() { if(msobj.scrollstep == 0)return; msobj.mouseover = 1; clearinterval(msobj.timerid); } msobj.id.onmouseout = function() { if(msobj.scrollstep == 0) { if(msobj.step == 0)msobj.step = 1; return; } msobj.mouseover = 0; if(msobj.stop == 0) { clearinterval(msobj.timerid); msobj.timerid = setinterval(msobj.startid,timer); } } } settimeout(msobj.begin,waittime); } marquee.prototype.scroll = function() { switch(this.direction) { case 0: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0) { this.id.scrolltop += this.scrollstep + this.step - this.ctl; this.pause(); return; } else { if(this.id.scrolltop >= this.clientscroll) { this.id.scrolltop -= this.clientscroll; } this.id.scrolltop += this.step; } break; case 1: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0) { this.id.scrolltop -= this.scrollstep + this.step - this.ctl; this.pause(); return; } else { if(this.id.scrolltop <= 0) { this.id.scrolltop += this.clientscroll; } this.id.scrolltop -= this.step; } break; case 2: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0) { this.id.scrollleft += this.scrollstep + this.step - this.ctl; this.pause(); return; } else { if(this.id.scrollleft >= this.clientscroll) { this.id.scrollleft -= this.clientscroll; } this.id.scrollleft += this.step; } break; case 3: this.ctl += this.step; if(this.ctl >= this.scrollstep && this.delaytime > 0) { this.id.scrollleft -= this.scrollstep + this.step - this.ctl; this.pause(); return; } else { if(this.id.scrollleft <= 0) { this.id.scrollleft += this.clientscroll; } this.id.scrollleft -= this.step; } break; } }