|
var jswindow=new Object(); jswindow.move=new Object(); jswindow.move.mouse=new Object(); jswindow.move.dragging=false; var jswindow_maxid=0; //最高窗口 var jswindow_id=0; //当前窗口 jswindow.opened=false; jswindow.closeimgurl=websiteaddress+"Images/System/dialogclose.gif"; jswindow.flickering=false; jswindow.flickertimes=0; jswindow.open=function(str_title,url,width,height,onclose){ /* ---------------------------------------------- ● 窗口Div清单 ---------------------------------------------- 0:窗口div容器 1:背景层 2:窗口阴影层 3:窗口主框架 4:窗口标题栏 5:窗口内容区 6:用于遮罩内容区的div 7:关闭按钮 ---------------------------------------------- */ top.jswindow_maxid++; top.jswindow_id=top.jswindow_maxid; this.info=top.window_info(); if (onclose==undefined || onclose==null) onclose="top.jswindow.close()"; //计算窗口出现时的坐标 var cw=this.info["Width"]; var ch=this.info["Height"]; var x=cw/2-width/2; var y=ch/2-height/2; if (x<0) x=0; if (y<0) y=0; x+=this.info["ScrollX"]; y+=this.info["ScrollY"]; var base=createNode("jswindow_base"+top.jswindow_id,'div',top.document.body); //0 base.className="jswindow"; var background=createNode('jswindow_background'+top.jswindow_id,'div',base); //1 background.className="background"; background.style.width=this.info["ContentWidth"]+"px"; background.style.height=this.info["ContentHeight"]+"px"; background.onmousedown=function(){jswindow.flicker();return false;}; background.oncontextmenu=function(){return false;}; var behind=createNode("jswindow_behind"+top.jswindow_id,'div',base); //2 behind.className="behind"; behind.style.left=(x+4)+"px"; behind.style.top=(y+4)+"px"; behind.style.width=width+"px"; behind.style.height=height+"px"; var frame=createNode("jswindow_frame"+top.jswindow_id,'div',base); //3 frame.className="frame"; frame.style.width=width+"px"; frame.style.height=height+"px"; frame.style.left=x+"px"; frame.style.top=y+"px"; this.move.mouse.lastmodalX=x; this.move.mouse.lastmodalY=y; var title=createNode("jswindow_title"+top.jswindow_id,"div",frame); //4 title.className="title"; title.innerHTML=str_title; title.onselectstart=function(){return false;}; title.oncontextmenu=function(){return false;}; var content=createNode("jswindow_content"+top.jswindow_id,"div",frame); //5 content.className="content"; content.innerHTML='<iframe id="jswindow_iframe'+top.jswindow_id+'" name="jswindow_iframe'+top.jswindow_id+'" src="'+url+'" width="100%" height="'+(height-26)+'" frameborder="no" marginwidth="0" marginheight="0" border="0" style="background-color:#FFFFFF"></iframe>'; var cover=createNode("jswindow_content_cover"+top.jswindow_id,"div",base); //6 cover.style.display="none"; cover.className="cover"; cover.style.left=(x+1)+"px"; cover.style.top=(y+25)+"px"; cover.style.width=(width-2)+"px"; cover.style.height=(height-26)+"px"; cover.oncontextmenu=function(){return false;}; var closediv=createNode("jswindow_closediv"+top.jswindow_id,"div",frame); //7 closediv.className="closediv"; closediv.style.right="6px"; closediv.style.top="5px"; closediv.oncontextmenu=function(){return false;}; var closelink=createNode("jswindow_closelink"+top.jswindow_id,"a",closediv); closelink.href="#"; closelink.onclick=new Function(onclose+";return false"); closelink.title="关闭"; closelink.oncontextmenu=function(){return false;}; var closeimg=createNode("jswindow_closeimg"+top.jswindow_id,"img",closelink); closeimg.src=this.closeimgurl; closeimg.style.border="none"; closeimg.oncontextmenu=function(){return false;}; title.onmousedown=function(event){jswindow.move.start(event);return false;}; } jswindow.close=function(){ drapNode("jswindow_base"+top.jswindow_id); top.jswindow_maxid--; top.jswindow_id=top.jswindow_maxid; } jswindow.move.start=function(event){ if (!event) event=top.window.event; this.mouse.button=event.button; if (this.mouse.button!=1) return false; //只能用鼠标左键拖移窗口 this.mouse.startX=event.pageX?event.pageX:event.screenX; this.mouse.startY=event.pageY?event.pageY:event.screenY; this.mouse.modalX=this.mouse.lastmodalX; this.mouse.modalY=this.mouse.lastmodalY; top.document.onmousemove=function(event){jswindow.move.drag(event);return false;}; top.document.onmouseup=function(){jswindow.move.end();return false;}; $_DAM("jswindow_content_cover"+top.jswindow_id).style.display=""; this.dragging=true; } jswindow.move.drag=function(event){ if (!event) event=top.window.event; if ((!this.dragging) || event.button!=this.mouse.button){ this.end(); }else{ var eventX=typeof(event.pageX)!='undefined'?event.pageX:event.screenX; var eventY=typeof(event.pageY)!='undefined'?event.pageY:event.screenY; var xChange=eventX-this.mouse.startX+this.mouse.modalX; var yChange=eventY-this.mouse.startY+this.mouse.modalY; this.changeposition(xChange,yChange); } } jswindow.move.end=function(){ top.document.onmousemove=null; top.document.onmouseup=null; $_DAM("jswindow_content_cover"+top.jswindow_id).style.display="none"; this.dragging=false; } jswindow.move.changeposition=function(cx,cy){ var wid=top.jswindow_id; if (cx<0) cx=0; //左上角x坐标(浏览器左边框到js窗口左边框的距离) if (cy<0) cy=0; //左上角y坐标(浏览器上边框到js窗口上边框的距离) var beh=$_DAM('jswindow_background'+wid).style; var dx=Number(beh.width.replace(/px$/gi,'')); //背景层宽度 var dy=Number(beh.height.replace(/px$/gi,'')); //背景层高度 beh=$_DAM('jswindow_frame'+wid).style; var ew=Number(beh.width.replace(/px$/gi,'')); //当前js窗口宽度 var eh=Number(beh.height.replace(/px$/gi,'')); //当前js窗口高度 var fx=cx+ew+4; //窗口右上角x坐标 var fy=cy+eh+4; //窗口右下角y坐标 //防止窗口超出背景层 if (fx>dx) cx=dx-ew-4; if (fy>dy) cy=dy-eh-4; beh=$_DAM('jswindow_behind'+wid).style; beh.left=(cx+4)+"px"; beh.top=(cy+4)+"px"; beh=$_DAM('jswindow_frame'+wid).style; beh.left=cx+"px"; beh.top=cy+"px"; beh=$_DAM('jswindow_content_cover'+wid).style; beh.left=(cx+1)+"px"; beh.top=(cy+25)+"px"; this.mouse.lastmodalX=cx; this.mouse.lastmodalY=cy; } jswindow.flicker=function(){ var wid=top.jswindow_id; var b=this.flickertimes; this.flickertimes+=8; if (!this.flickering){ //防止重复创建周期执行对象 $_DAM('jswindow_content_cover'+wid).style.display=''; this.flickering=true; this.timeoutId=window.setInterval(this.flickerings,70); this.flickerfx=0; } } jswindow.flickerings=function(){ var f=$_DAM('jswindow_frame'+top.jswindow_id).style; if (jswindow.flickertimes<1){ window.clearTimeout(jswindow.timeoutId); $_DAM('jswindow_content_cover'+top.jswindow_id).style.display='none'; f.background='#6B97CE'; jswindow.flickering=false; jswindow.flickertimes=0; return true; }else{ f.background=(jswindow.flickerfx==0)?'#93B4DB':'#6B97CE'; jswindow.flickerfx=(jswindow.flickerfx==0)?1:0; jswindow.flickertimes--; } }
|
|
var xmlDoc; /*-------------------------------------------------------------------------- ● 字符串相关函数 --------------------------------------------------------------------------*/ function Trim(s){ return s.replace(/(^\s*)|(\s*$)/g,""); } function True(s){ var reg=/^[\w\u4e00-\u9fa5ⅠⅡⅢⅣⅤⅥⅦⅧ·ⅨⅩⅪⅫ\+\-]+$/; return reg.test(s); } function Length(s){ var d=0; var a=s.split(""); for (i=0;i<a.length;i++){ if (a[i].charCodeAt(0)<299){ d++; }else{ d+=2; } } return d; } function is_number(n){ //判断是否为有理数(不是循环小数) var reg=/^[\-\+]?[1-9]*\d(\.\d+)?$/; return reg.test(n); } /*-------------------------------------------------------------------------- ● 验证码 --------------------------------------------------------------------------*/ var captcha_id=0; function captcha_update(name,kongjianname){ if (name=="") name='captcha_image'; if (kongjianname=="") kongjianname='captcha_val'; captcha_id++; var url=currentaddress+'Include/Captcha.php?k='+captcha_id; $_DOM(name).src=url; $_DOM(kongjianname).value=''; $_DOM(kongjianname).focus(); return false; } function captcha_true(kongjianname,baocuospan){ if (kongjianname=="") kongjianname='captcha_val'; if (baocuospan=="") baocuospan='captcha_error_span'; $_DOM(kongjianname).value=Trim($_DOM(kongjianname).value); if ($_DOM(kongjianname).value==""){ $_DOM(baocuospan).innerHTML='请输入验证码'; return false; }else{ $_DOM(baocuospan).innerHTML=''; return true; } } /*-------------------------------------------------------------------------- ● 表单相关函数 --------------------------------------------------------------------------*/ function value_radio(id){ // 获得单选框的值 var val=$_DOM(id); for (var i=0;i<val.length;i++){ if (val[i].checked) return val[i].value; } } function value_checkbox(id,explode){ // 获得复选框的值 var val=$_DOM(id); var ret=""; for (var i=0;i<val.length;i++){ if (val[i].checked){ if (ret==""){ ret=val[i].value; }else{ ret=ret+explode+val[i].value; } } } return ret; } function formarea_loaded(){ //处理IFRAME方式提交的帖子数据 try{ var msg=window.frames['form_area'].document.getElementById('msg').innerHTML; if (msg=="default") return false; else if (msg=="created") F5(); else if (msg=="OK") window.frames['form_area'].document.location='Include/default2.php'; else topic_alert(msg,(msg=="验证码输入错误" || msg=="验证码超时,请重新输入")?'topic_alerted_yzm':'topic_alerted_else'); }catch(e){ alert('无法连接到服务器,请检查您的网络连接'); document.form1.button3.disabled=false; return false; } } /*-------------------------------------------------------------------------- ● 搜索框 --------------------------------------------------------------------------*/ function search_submit(){ var span=document.search_form.text; span.value=Trim(span.value); if (span.value==""){ span.focus(); return false; }else{ return true; } } function set_searchtext(str){ document.search_form.text.value=str; return true; } function search_start(){ document.search_form.text.focus(); return true; } /*-------------------------------------------------------------------------- ● 模态窗口函数 --------------------------------------------------------------------------*/ function diag_close(){ try{ top.window_close(); }catch(e){ return false; } } function window_open(tit,url,wid,hei,userdefined){ top.jswindow.open(tit,url,wid,hei); } function window_close(){ top.jswindow.close(); } function Alert(title,msg,w,h,fun){ if (fun==undefined) fun=''; var ru='../Include/Alert.php?t='+title+'&m='+msg+'&fun='+fun; window_open(title,ru,w,h,true); } function Confirm(title,msg,w,h,func){ window_open(title,'../Include/Confirm.php?t='+title+'&m='+msg+'&u='+func,w,h); } function window_info(){ var ret=Array(); var scrollX=0,scrollY=0,width=0,height=0,contentWidth=0,contentHeight=0; if (typeof(window.pageXOffset)=="number"){ scrollX=window.pageXOffset; scrollY=window.pageYOffset; }else if (document.body&&(document.body.scrollLeft||document.body.scrollTop)){ scrollX=document.body.scrollLeft; scrollY=document.body.scrollTop; }else if (document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){ scrollX=document.documentElement.scrollLeft; scrollY=document.documentElement.scrollTop; } if (typeof(window.innerWidth)=="number"){ width=window.innerWidth; height=window.innerHeight; }else if (document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){ width=document.documentElement.clientWidth; height=document.documentElement.clientHeight; }else if (document.body&&(document.body.clientWidth||document.body.clientHeight)){ width=document.body.clientWidth; height=document.body.clientHeight; } if (document.documentElement&&(document.documentElement.scrollHeight||document.documentElement.offsetHeight)){ if (document.documentElement.scrollHeight>document.documentElement.offsetHeight){ contentWidth=document.documentElement.scrollWidth; contentHeight=document.documentElement.scrollHeight; }else{ contentWidth=document.documentElement.offsetWidth; contentHeight=document.documentElement.offsetHeight; } }else if (document.body&&(document.body.scrollHeight||document.body.offsetHeight)){ if (document.body.scrollHeight>document.body.offsetHeight){ contentWidth=document.body.scrollWidth; contentHeight=document.body.scrollHeight; }else{ contentWidth=document.body.offsetWidth; contentHeight=document.body.offsetHeight; } }else{ contentWidth=width; contentHeight=height; } if (height>contentHeight) height=contentHeight; if (width>contentWidth) width=contentWidth; ret['ScrollX']=scrollX; ret['ScrollY']=scrollY; ret['Width']=width; ret['Height']=height; ret['ContentWidth']=contentWidth; ret['ContentHeight']=contentHeight; return ret; } /*-------------------------------------------------------------------------- ● 文档对象操作函数 --------------------------------------------------------------------------*/ function $_DOM(id){ return document.getElementById(id); } function $_DAM(obj){ return top.document.getElementById(obj); } function dom_delete($ob){ document.body.removeChild($_DOM($ob)); return true; } function createNode(ikk,lable_name,weizhi){ var nod=top.document.createElement(lable_name); nod.id=ikk; weizhi.appendChild(nod); return nod; //返回创建的节点 } function createAttribute(name,value,weizhi){ var nod=top.document.createAttribute(name); nod.value=value; weizhi.setAttributeNode(nod); return nod; } function window_setTitle(s){ $_DOM('window_title').innerHTML=s; } function dropNode(id){ id=id.split(','); for (i=0;i<id.length;i++) dom_delete(id[i]); } function drapNode(id){ id=id.split(','); for (i=0;i<id.length;i++) top.document.body.removeChild($_DAM(id[i])); } function divPosition(e){ var x=e.offsetLeft; var y=e.offsetTop; while(e=e.offsetParent){ x+=e.offsetLeft; y+=e.offsetTop; } var t=Array(); t['x']=x; t['y']=y; return t; } function sed(obj,con){ try{ obj.innerHTML=con; return true; }catch(e){ return false; } } function $_URL(id){ //获取url变量的值 var qs=document.location.search.replace(/\?/gi,'').split('&'); var ds=Array(); for (var i=0;i<qs.length;i++){ qs[i]=qs[i].split('='); ds[qs[i][0]]=qs[i][1]; } if (ds[id]==undefined) ds[id]=''; return ds[id]; } /*-------------------------------------------------------------------------- ● Cookie函数 --------------------------------------------------------------------------*/ function Cookie(id){ var cookies=document.cookie(); cookies=cookies.split(';'); for (i=0;i<cookies.length;i++) cookies[i]=cookies[i].split('='); for (var i=0;i<cookies.length;i++) if (cookies[i][0]==id) return unescape(cookies[i][1]); } function setCookie(name,val){ document.cookie=name+"="+escape(val); } /*-------------------------------------------------------------------------- ● XML --------------------------------------------------------------------------*/ function loadXML(xmlFile){ var _xmlDoc=null; if (window.ActiveXObject) _xmlDoc=new ActiveXObject('Microsoft.XMLDOM'); else{ try{ _xmlDoc=document.implementation.createDocument('','',null); }catch(ex){ alert(ex.message); _xmlDoc=null; } } if (_xmlDoc!=null){ _xmlDoc.async=false; try{ _xmlDoc.load(xmlFile); }catch(ex){ alert(ex.message); _xmlDoc=null; } return _xmlDoc; } } function xmlvalue(obj){ return obj.firstChild.nodeValue; } /*-------------------------------------------------------------------------- ● Ajax --------------------------------------------------------------------------*/ function ajaxcode(str){ var regs=[[],['*0','*1','*2','*3','*4','*5','*6']]; regs[0][0]=/\*/gi; regs[0][1]=/\+/gi; regs[0][2]=/\//gi; regs[0][3]=/\?/gi; regs[0][4]=/&/gi; regs[0][5]=/#/gi; regs[0][6]=/%/gi; for (var i=0;i<regs[0].length;i++) str=str.replace(regs[0][i],regs[1][i]); return str; } /*-------------------------------------------------------------------------- ● 其他函数 --------------------------------------------------------------------------*/ function copy($str){ window.clipboardData.setData("Text",$str); return true; } function wait(z){ var j=0; z*=100000; for (var i=0;i<z;i++) j++; alert(z); return true; } function blank(){}; function Escape(str){ return escape(str); } function F5(){ document.location=window.location.href; return true; } function browser_ie(){ return window.attachEvent&&(!window.opera); } function spali(){ var msg=top.window.frames['newiframe'].document.getElementById('msg').innerHTML; if (msg=="default") return false; var stt="OK(name="; var str=msg.substring(0,stt.length); if (msg=="") msg="未知错误"; else if (str==stt){ var file_name=msg.split('='); file_name=file_name[1].split(')'); file_name=file_name[0]; var cot='<img src="'+file_name+'" border="0" onload="if (this.height>428) this.height=428;if (this.width>570) this.width=570" />'; editor_insert(cot); top.window_close(); }else Alert('上传失败',msg,400,110,'spalierrored()'); } function $_DAMW(obj){ if (obj=="window_close_img") obj="window_closeimg"; //旧版本兼容代码 return $_DAM("js"+obj+String(top.jswindow_id)); } function $_WIN(fx){ if (fx==undefined) fx=0; var ob=window.frames['window_iframes_for'+String(top.window_id-fx)]; return ob; } function redir(url){ document.location=url; } function isundefined(v){ return (v=="undefined"); } function past_class(vari,name){ if (Trim(vari)==""){ return vari; }else{ return vari+' '+name; } } /*-------------------------------------------------------------------------- ● 通用函数 --------------------------------------------------------------------------*/ function spalierrored(){ with($_WIN(1)){ document.getElementById('button').disabled=false; document.getElementById('fileField').focus(); } diag_close(); } function show_membertequans(){ window_open('会员特权','Include/membertequan.php',542,205); return false; } function bdkjdgyj_play(fstr){ window_open('百度空间动感电视系列剧',fstr,480,394); } /*-------------------------------------------------------------------------- ● 获取数据 --------------------------------------------------------------------------*/ xa=loadXML("../fictitious/Ajax/website.xml"); //读取虚拟目录中的xml数据文件 xn=xa.documentElement; //website根节点 var website_address=xn.getAttribute('address'); //网站根地址 var website_name=xn.getAttribute('name'); //网站名称 io=xn.childNodes[1].childNodes; //产品目录 ion=io.length; //产品数量 var website_products=Array(); for (i=0;i<ion;i++) website_products[io[i].getAttribute('comment')]=io[i].getAttribute('address'); //循环遍历各产品 var tieba_address=website_products['贴吧']; websiteaddress=tieba_address; var currentaddress='http://'+document.location.hostname+"/";
|