var djt = { $: function (objname) { return document.getelementbyid(objname); }, isie: navigator.appversion.indexof("msie") != -1 ? true : false, addevent: function (l, i, i) { if (l.attachevent) { l.attachevent("on" + i, i) } else { l.addeventlistener(i, i, false) } }, delevent: function (l, i, i) { if (l.detachevent) { l.detachevent("on" + i, i) } else { l.removeeventlistener(i, i, false) } } }; //滚动图片构造函数 // new scrollpicleft('滚动区id','左按钮id','右按钮id',滚动区宽度,翻页宽度,移动速度(单位毫秒,越小越快),每次移动像素(单位px,越大越快),自动播放,自动播放间隔时间,'分页id'); // new scrollpicleft('id','leftid','rightid',958,220,2,8,true,3000); function scrollpicleft2(scrollcontid, arrleftid, arrrightid, framewidth, pagewidth, speed, space, autoplay, autoplaytime, dotlistid) { this.scrollcontid = scrollcontid; this.arrleftid = arrleftid; this.arrrightid = arrrightid; this.dotlistid = dotlistid; this.dotclassname = "dotitem"; this.dotonclassname = "dotitemon"; this.dotobjarr = []; this.pagewidth = pagewidth; this.framewidth = framewidth; this.speed = speed; this.space = space; this.pageindex = 0; this.autoplay = autoplay; this.autoplaytime = autoplaytime; var _autotimeobj, _scrolltimeobj, _state = "ready"; this.stripdiv = document.createelement("div"); this.listdiv01 = document.createelement("div"); this.listdiv02 = document.createelement("div"); if (!scrollpicleft.childs) { scrollpicleft.childs = [] }; this.id = scrollpicleft.childs.length; scrollpicleft.childs.push(this); this.initialize = function () { if (!this.scrollcontid) { throw new error("必须指定scrollcontid."); return }; this.scrollcontdiv = djt.$(this.scrollcontid); if (!this.scrollcontdiv) { throw new error("scrollcontid不是正确的对象.(scrollcontid = \"" + this.scrollcontid + "\")"); return }; this.scrollcontdiv.style.width = this.framewidth + "px"; this.scrollcontdiv.style.overflow = "hidden"; this.listdiv01.innerhtml = this.listdiv02.innerhtml = this.scrollcontdiv.innerhtml; this.scrollcontdiv.innerhtml = ""; this.scrollcontdiv.appendchild(this.stripdiv); this.stripdiv.appendchild(this.listdiv01); this.stripdiv.appendchild(this.listdiv02); this.stripdiv.style.overflow = "hidden"; this.stripdiv.style.zoom = "1"; this.stripdiv.style.width = "32766px"; var isie = navigator.useragent.touppercase().indexof("msie") == -1 ? false : true; if (isie) { this.listdiv01.style.stylefloat = "left"; this.listdiv02.style.stylefloat = "left"; } else { this.listdiv01.style.cssfloat = "left"; this.listdiv02.style.cssfloat = "left"; } djt.addevent(this.scrollcontdiv, "mouseover", function("scrollpicleft.childs[" + this.id + "].stop()")); djt.addevent(this.scrollcontdiv, "mouseout", function("scrollpicleft.childs[" + this.id + "].play()")); if (this.arrleftid) { this.arrleftobj = djt.$(this.arrleftid); if (this.arrleftobj) { djt.addevent(this.arrleftobj, "mousedown", function("scrollpicleft.childs[" + this.id + "].rightmousedown()")); djt.addevent(this.arrleftobj, "mouseup", function("scrollpicleft.childs[" + this.id + "].rightend()")); djt.addevent(this.arrleftobj, "mouseout", function("scrollpicleft.childs[" + this.id + "].rightend()")) } }; if (this.arrrightid) { this.arrrightobj = djt.$(this.arrrightid); if (this.arrrightobj) { djt.addevent(this.arrrightobj, "mousedown", function("scrollpicleft.childs[" + this.id + "].leftmousedown()")); djt.addevent(this.arrrightobj, "mouseup", function("scrollpicleft.childs[" + this.id + "].leftend()")); djt.addevent(this.arrrightobj, "mouseout", function("scrollpicleft.childs[" + this.id + "].leftend()")) } }; if (this.dotlistid) { this.dotlistobj = djt.$(this.dotlistid); if (this.dotlistobj) { var pages = math.round(this.listdiv01.offsetwidth / this.framewidth + 0.4), i, tempobj; for (i = 0; i < pages; i++) { tempobj = document.createelement("span"); this.dotlistobj.appendchild(tempobj); this.dotobjarr.push(tempobj); if (i == this.pageindex) { tempobj.classname = this.dotclassname } else { tempobj.classname = this.dotonclassname }; tempobj.title = "第" + (i + 1) + "页"; djt.addevent(tempobj, "click", function("scrollpicleft.childs[" + this.id + "].pageto(" + i + ")")) } } }; if (this.autoplay) { this.play() } }; this.leftmousedown = function () { if (_state != "ready") { return }; _state = "floating"; _scrolltimeobj = setinterval("scrollpicleft.childs[" + this.id + "].moveleft()", this.speed) }; this.rightmousedown = function () { if (_state != "ready") { return }; _state = "floating"; _scrolltimeobj = setinterval("scrollpicleft.childs[" + this.id + "].moveright()", this.speed) }; this.moveleft = function () { if (this.scrollcontdiv.scrollleft + this.space >= this.listdiv01.scrollwidth) { this.scrollcontdiv.scrollleft = this.scrollcontdiv.scrollleft + this.space - this.listdiv01.scrollwidth } else { this.scrollcontdiv.scrollleft += this.space }; this.accountpageindex() }; this.moveright = function () { if (this.scrollcontdiv.scrollleft - this.space <= 0) { this.scrollcontdiv.scrollleft = this.listdiv01.scrollwidth + this.scrollcontdiv.scrollleft - this.space } else { this.scrollcontdiv.scrollleft -= this.space }; this.accountpageindex() }; this.leftend = function () { if (_state != "floating") { return }; _state = "stoping"; clearinterval(_scrolltimeobj); var fill = this.pagewidth - this.scrollcontdiv.scrollleft % this.pagewidth; this.move(fill) }; this.rightend = function () { if (_state != "floating") { return }; _state = "stoping"; clearinterval(_scrolltimeobj); var fill = -this.scrollcontdiv.scrollleft % this.pagewidth; this.move(fill) }; this.move = function (num, quick) { var thismove = num / 5; if (!quick) { if (thismove > this.space) { thismove = this.space }; if (thismove < -this.space) { thismove = -this.space } }; if (math.abs(thismove) < 1 && thismove != 0) { thismove = thismove >= 0 ? 1 : -1 } else { thismove = math.round(thismove) }; var temp = this.scrollcontdiv.scrollleft + thismove; if (thismove > 0) { if (this.scrollcontdiv.scrollleft + thismove >= this.listdiv01.scrollwidth) { this.scrollcontdiv.scrollleft = this.scrollcontdiv.scrollleft + thismove - this.listdiv01.scrollwidth } else { this.scrollcontdiv.scrollleft += thismove } } else { if (this.scrollcontdiv.scrollleft - thismove <= 0) { this.scrollcontdiv.scrollleft = this.listdiv01.scrollwidth + this.scrollcontdiv.scrollleft - thismove } else { this.scrollcontdiv.scrollleft += thismove } }; num -= thismove; if (math.abs(num) == 0) { _state = "ready"; if (this.autoplay) { this.play() }; this.accountpageindex(); return } else { this.accountpageindex(); settimeout("scrollpicleft.childs[" + this.id + "].move(" + num + "," + quick + ")", this.speed) } }; this.next = function () { if (_state != "ready") { return }; _state = "stoping"; this.move(this.pagewidth, true) }; this.play = function () { if (!this.autoplay) { return }; clearinterval(_autotimeobj); _autotimeobj = setinterval("scrollpicleft.childs[" + this.id + "].next()", this.autoplaytime * 1000) }; this.stop = function () { clearinterval(_autotimeobj) }; this.pageto = function (num) { if (_state != "ready") { return }; _state = "stoping"; var fill = num * this.framewidth - this.scrollcontdiv.scrollleft; this.move(fill, true) }; this.accountpageindex = function () { this.pageindex = math.round(this.scrollcontdiv.scrollleft / this.framewidth); if (this.pageindex > math.round(this.listdiv01.offsetwidth / this.framewidth + 0.4) - 1) { this.pageindex = 0 }; var i; for (i = 0; i < this.dotobjarr.length; i++) { if (i == this.pageindex) { this.dotobjarr[i].classname = this.dotclassname } else { this.dotobjarr[i].classname = this.dotonclassname } } } this.initialize(); }; function scrollpicleft(scrollcontid, arrleftid, arrrightid,pagewidth,framewidth) { this.scrollcontid = scrollcontid; this.arrleftid = arrleftid; this.arrrightid = arrrightid; this.dotlistid = 1; this.dotclassname = "dotitem"; this.dotonclassname = "dotitemon"; this.dotobjarr = []; this.pagewidth = pagewidth; this.framewidth = framewidth; this.speed = 10; this.space = 10; this.pageindex = 0; this.autoplay = true; this.autoplaytime = 3; var _autotimeobj, _scrolltimeobj, _state = "ready"; this.stripdiv = document.createelement("div"); this.listdiv01 = document.createelement("div"); this.listdiv02 = document.createelement("div"); if (!scrollpicleft.childs) { scrollpicleft.childs = [] }; this.id = scrollpicleft.childs.length; scrollpicleft.childs.push(this); this.initialize = function () { if (!this.scrollcontid) { throw new error("必须指定scrollcontid."); return }; this.scrollcontdiv = djt.$(this.scrollcontid); if (!this.scrollcontdiv) { throw new error("scrollcontid不是正确的对象.(scrollcontid = \"" + this.scrollcontid + "\")"); return }; this.scrollcontdiv.style.width = this.framewidth + "px"; this.scrollcontdiv.style.overflow = "hidden"; this.listdiv01.innerhtml = this.listdiv02.innerhtml = this.scrollcontdiv.innerhtml; this.scrollcontdiv.innerhtml = ""; this.scrollcontdiv.appendchild(this.stripdiv); this.stripdiv.appendchild(this.listdiv01); this.stripdiv.appendchild(this.listdiv02); this.stripdiv.style.overflow = "hidden"; this.stripdiv.style.zoom = "1"; this.stripdiv.style.width = "32766px"; var isie = navigator.useragent.touppercase().indexof("msie") == -1 ? false : true; if (isie) { this.listdiv01.style.stylefloat = "left"; this.listdiv02.style.stylefloat = "left"; } else { this.listdiv01.style.cssfloat = "left"; this.listdiv02.style.cssfloat = "left"; } djt.addevent(this.scrollcontdiv, "mouseover", function("scrollpicleft.childs[" + this.id + "].stop()")); djt.addevent(this.scrollcontdiv, "mouseout", function("scrollpicleft.childs[" + this.id + "].play()")); if (this.arrleftid) { this.arrleftobj = djt.$(this.arrleftid); if (this.arrleftobj) { djt.addevent(this.arrleftobj, "mousedown", function("scrollpicleft.childs[" + this.id + "].rightmousedown()")); djt.addevent(this.arrleftobj, "mouseup", function("scrollpicleft.childs[" + this.id + "].rightend()")); djt.addevent(this.arrleftobj, "mouseout", function("scrollpicleft.childs[" + this.id + "].rightend()")) } }; if (this.arrrightid) { this.arrrightobj = djt.$(this.arrrightid); if (this.arrrightobj) { djt.addevent(this.arrrightobj, "mousedown", function("scrollpicleft.childs[" + this.id + "].leftmousedown()")); djt.addevent(this.arrrightobj, "mouseup", function("scrollpicleft.childs[" + this.id + "].leftend()")); djt.addevent(this.arrrightobj, "mouseout", function("scrollpicleft.childs[" + this.id + "].leftend()")) } }; if (this.dotlistid) { this.dotlistobj = djt.$(this.dotlistid); if (this.dotlistobj) { var pages = math.round(this.listdiv01.offsetwidth / this.framewidth + 0.4), i, tempobj; for (i = 0; i < pages; i++) { tempobj = document.createelement("span"); this.dotlistobj.appendchild(tempobj); this.dotobjarr.push(tempobj); if (i == this.pageindex) { tempobj.classname = this.dotclassname } else { tempobj.classname = this.dotonclassname }; tempobj.title = "第" + (i + 1) + "页"; djt.addevent(tempobj, "click", function("scrollpicleft.childs[" + this.id + "].pageto(" + i + ")")) } } }; if (this.autoplay) { this.play() } }; this.leftmousedown = function () { if (_state != "ready") { return }; _state = "floating"; _scrolltimeobj = setinterval("scrollpicleft.childs[" + this.id + "].moveleft()", this.speed) }; this.rightmousedown = function () { if (_state != "ready") { return }; _state = "floating"; _scrolltimeobj = setinterval("scrollpicleft.childs[" + this.id + "].moveright()", this.speed) }; this.moveleft = function () { if (this.scrollcontdiv.scrollleft + this.space >= this.listdiv01.scrollwidth) { this.scrollcontdiv.scrollleft = this.scrollcontdiv.scrollleft + this.space - this.listdiv01.scrollwidth } else { this.scrollcontdiv.scrollleft += this.space }; this.accountpageindex() }; this.moveright = function () { if (this.scrollcontdiv.scrollleft - this.space <= 0) { this.scrollcontdiv.scrollleft = this.listdiv01.scrollwidth + this.scrollcontdiv.scrollleft - this.space } else { this.scrollcontdiv.scrollleft -= this.space }; this.accountpageindex() }; this.leftend = function () { if (_state != "floating") { return }; _state = "stoping"; clearinterval(_scrolltimeobj); var fill = this.pagewidth - this.scrollcontdiv.scrollleft % this.pagewidth; this.move(fill) }; this.rightend = function () { if (_state != "floating") { return }; _state = "stoping"; clearinterval(_scrolltimeobj); var fill = -this.scrollcontdiv.scrollleft % this.pagewidth; this.move(fill) }; this.move = function (num, quick) { var thismove = num / 5; if (!quick) { if (thismove > this.space) { thismove = this.space }; if (thismove < -this.space) { thismove = -this.space } }; if (math.abs(thismove) < 1 && thismove != 0) { thismove = thismove >= 0 ? 1 : -1 } else { thismove = math.round(thismove) }; var temp = this.scrollcontdiv.scrollleft + thismove; if (thismove > 0) { if (this.scrollcontdiv.scrollleft + thismove >= this.listdiv01.scrollwidth) { this.scrollcontdiv.scrollleft = this.scrollcontdiv.scrollleft + thismove - this.listdiv01.scrollwidth } else { this.scrollcontdiv.scrollleft += thismove } } else { if (this.scrollcontdiv.scrollleft - thismove <= 0) { this.scrollcontdiv.scrollleft = this.listdiv01.scrollwidth + this.scrollcontdiv.scrollleft - thismove } else { this.scrollcontdiv.scrollleft += thismove } }; num -= thismove; if (math.abs(num) == 0) { _state = "ready"; if (this.autoplay) { this.play() }; this.accountpageindex(); return } else { this.accountpageindex(); settimeout("scrollpicleft.childs[" + this.id + "].move(" + num + "," + quick + ")", this.speed) } }; this.next = function () { if (_state != "ready") { return }; _state = "stoping"; this.move(this.pagewidth, true) }; this.play = function () { if (!this.autoplay) { return }; clearinterval(_autotimeobj); _autotimeobj = setinterval("scrollpicleft.childs[" + this.id + "].next()", this.autoplaytime * 1000) }; this.stop = function () { clearinterval(_autotimeobj) }; this.pageto = function (num) { if (_state != "ready") { return }; _state = "stoping"; var fill = num * this.framewidth - this.scrollcontdiv.scrollleft; this.move(fill, true) }; this.accountpageindex = function () { this.pageindex = math.round(this.scrollcontdiv.scrollleft / this.framewidth); if (this.pageindex > math.round(this.listdiv01.offsetwidth / this.framewidth + 0.4) - 1) { this.pageindex = 0 }; var i; for (i = 0; i < this.dotobjarr.length; i++) { if (i == this.pageindex) { this.dotobjarr[i].classname = this.dotclassname } else { this.dotobjarr[i].classname = this.dotonclassname } } } this.initialize(); }; function marquee(){this.id=document.getelementbyid(arguments[0]);if(!this.id){alert('您要设置的"'+arguments[0]+'"初始化错误\r\n请检查标签id设置是否正确!');this.id=-1;return}this.direction=this.width=this.height=this.delaytime=this.waittime=this.ctl=this.startid=this.stop=this.mouseover=0;this.step=1;this.timer=30;this.directionarray={top:0,up:0,bottom:1,down:1,left:2,right:3};if(typeof arguments[1]=="number"||typeof arguments[1]=="string"){this.direction=arguments[1]}if(typeof arguments[2]=="number"){this.step=arguments[2]}if(typeof arguments[3]=="number"){this.width=arguments[3]}if(typeof arguments[4]=="number"){this.height=arguments[4]}if(typeof arguments[5]=="number"){this.timer=arguments[5]}if(typeof arguments[6]=="number"){this.delaytime=arguments[6]}if(typeof arguments[7]=="number"){this.waittime=arguments[7]}if(typeof arguments[8]=="number"){this.scrollstep=arguments[8]}this.id.style.overflow=this.id.style.overflowx=this.id.style.overflowy="hidden";this.id.nowrap=true;this.isnotopera=(navigator.useragent.tolowercase().indexof("opera")==-1);if(arguments.length>=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 d="
msclass_temp_htmlmsclass_temp_html
";var b="
msclass_temp_html
msclass_temp_html
";var e=this;e.temphtml=e.id.innerhtml;if(e.direction<=1){e.id.innerhtml=b.replace(/msclass_temp_html/g,e.id.innerhtml)}else{if(e.scrollstep==0&&e.delaytime==0){e.id.innerhtml+=e.id.innerhtml}else{e.id.innerhtml=d.replace(/msclass_temp_html/g,e.id.innerhtml)}}var f=this.timer;var a=this.delaytime;var c=this.waittime;e.startid=function(){e.scroll()};e.continue=function(){if(e.mouseover==1){settimeout(e.continue,a)}else{clearinterval(e.timerid);e.ctl=e.stop=0;e.timerid=setinterval(e.startid,f)}};e.pause=function(){e.stop=1;clearinterval(e.timerid);settimeout(e.continue,a)};e.begin=function(){e.clientscroll=e.direction>1?e.id.scrollwidth/2:e.id.scrollheight/2;if((e.direction<=1&&e.clientscroll<=e.height+e.step)||(e.direction>1&&e.clientscroll<=e.width+e.step)){e.id.innerhtml=e.temphtml;delete (e.temphtml);return}delete (e.temphtml);e.timerid=setinterval(e.startid,f);if(e.scrollstep<0){return}e.id.onmousemove=function(g){if(e.scrollstep==0&&e.direction>1){var g=g||window.event;if(window.event){if(e.isnotopera){e.eventleft=g.srcelement.id==e.id.id?g.offsetx-e.id.scrollleft:g.srcelement.offsetleft-e.id.scrollleft+g.offsetx}else{e.scrollstep=null;return}}else{e.eventleft=g.layerx-e.id.scrollleft}e.direction=e.eventleft>e.halfwidth?3:2;e.abscenter=math.abs(e.halfwidth-e.eventleft);e.step=math.round(e.abscenter*(e.bakstep*2)/e.halfwidth)}};e.id.onmouseover=function(){if(e.scrollstep==0){return}e.mouseover=1;clearinterval(e.timerid)};e.id.onmouseout=function(){if(e.scrollstep==0){if(e.step==0){e.step=1}return}e.mouseover=0;if(e.stop==0){clearinterval(e.timerid);e.timerid=setinterval(e.startid,f)}}};settimeout(e.begin,c)};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}}; function sethome(obj,vrl){ try{ obj.style.behavior='url(#default#homepage)';obj.sethomepage(vrl); } catch(e){ if(window.netscape) { 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',vrl); }else{ alert("您的浏览器不支持,请按照下面步骤操作:1.打开浏览器设置。2.点击设置网页。3.输入:"+vrl+"点击确定。"); } } } // 加入收藏 兼容360和ie6 function addfavorite(stitle,surl) { try { window.external.addfavorite(surl, stitle); } catch (e) { try { window.sidebar.addpanel(stitle, surl, ""); } catch (e) { alert("加入收藏失败,请使用ctrl+d进行添加"); } } }