variconwar="<imgsrc=/AliImages/icon_war.gifalign=absmiddle/>";
variconload="<imgsrc=/AliImages/ajaxload.gifalign=absmiddle/>";
varbadstr="!&^#|%$)(-+/?<>@`~';:{}[],=".";
varbadsql="!&^|+/?<>`~'=";
var$show=function(e){try{document.getElementById(e).style.display="";}catch(e){}};
var$hide=function(e){try{document.getElementById(e).style.display="none";}catch(e){}};
var$W=document.write;
varreurl,js_UserName;
reurl=document.referrer;
if(reurl=="")
{
reurl="/index.html";
}
functiononDisplay(id){
if(document.getElementById(id).style.display=='none'){
$show(id);
}
else{
$hide(id);
}
}
functiononLabelTxt(id,LabelID,ShowTxt,HideTxt){
if(document.getElementById(id).style.display=='none'){
$show(id);
document.getElementById(LabelID).value=HideTxt;
}
else{
$hide(id);
document.getElementById(LabelID).value=ShowTxt;
}
}
functionlistdisp(tid,lid){
if(document.getElementById(tid).style.display=='none'){
$show(tid);
}
else{
$hide(tid);
}
if(lid=='t1'){
return't1_off';
}
elseif(lid=='t2'){
return't2_off';
}
elseif(lid=='t1_off'){
return't1';
}
elseif(lid=='t2_off'){
return't2';
}
}
functiontrim(str){
return(str+'').replace(/(s+)$/g,'').replace(/^s+/g,'');
}
functionaddbookmark(url,site){
if(is_ie){
window.external.addFavorite(url,site);
}else{
alert('Pleasepress"Ctrl+D"toaddbookmark');
}
}
//AJAX_START
varxmlhttp=null;
functioncreatexmlhttp(){
try{
xmlhttp=newActiveXObject("Msxml2.xmlhttp");
}
catch(e){
try{
xmlhttp=newActiveXObject("Microsoft.xmlhttp");
}
catch(oc){
xmlhttp=null;
}
}
if(!xmlhttp&&typeofXMLHttpRequest!="undefined"){
xmlhttp=newXMLHttpRequest();
}
if(!xmlhttp){
alert("您的浏览器不支AJAX特性,本页某些功能将无法正常使用!");
}
}
//js操作cookies函数*********************
functiondelcookie(name){
setcookie(name,"");
}
functiongetcookie(name){
varcookie_start=document.cookie.indexOf(name);
varcookie_end=document.cookie.indexOf(";",cookie_start);
returncookie_start==-1?'':unescape(document.cookie.substring(cookie_start+name.length+1,(cookie_end>cookie_start?cookie_end:document.cookie.length)));
}
functionsetcookie(cookieName,cookieValue,seconds){
varexpires=newDate();
varpath="/";
vardomain="alixixi.com";
varsecure="";
expires.setTime(expires.getTime()+seconds);
document.cookie=escape(cookieName)+'='+escape(cookieValue)
+(expires?';expires='+expires.toGMTString():'')
+(path?';path='+path:'/')
+(domain?';domain='+domain:'')
+(secure?';secure':'');
}
//GetQueryString***********************
varLocString=String(window.document.location.href);
functionGetQueryString(str){
varrs=newRegExp("(^|)"+str+"=([^&]*)(&|$)","gi").exec(LocString),tmp;
if(tmp=rs)returntmp[2];
return"";
}
//VScroll显示上翻单条标题************************
function_ge(a){returndocument.getElementById?document.getElementById(a):null;}
functionVScroll(){
varm_box=null;
varm_lineHeight=0;
varm_lineNum=0;
varm_splitStr='';
varm_speed=0;
varm_delay=0;
varm_pos=0;
varm_stopTimes=0;
varm_stop=false;
this.init=function(box,lnum,lheight,speed,delay,split){
m_box=_ge(box);
m_lineNum=lnum;
m_lineHeight=lheight;
m_speed=speed;
m_delay=delay;
m_splitStr=split;
}
this.play=function(){
if(m_stop){
return;
}
m_pos=m_box.scrollTop;
if(m_pos%m_lineHeight==0&&m_stopTimes<m_delay&&m_box.scrollTop<m_lineHeight*m_lineNum){
m_stopTimes++;
}else{
m_box.scrollTop++;
if(m_pos%m_lineHeight==0&&m_stopTimes>=m_delay){
m_stopTimes=0;
}
}
if(m_box.scrollTop>m_lineHeight*m_lineNum){
m_box.scrollTop=0;
}
}
this.show=function(){
setInterval(m_self+".play()",m_speed);
}
this.setSelf=function(n){
m_self=n;
}
this.stop=function(n){
m_stop=n;
}
}
functionshow_date(){
vartoday=newDate();
varday=newArray();
varstr='';
day[0]="日";
day[1]="一";
day[2]="二";
day[3]="三";
day[4]="四";
day[5]="五";
day[6]="六";
str+=today.getFullYear();
str+="年";
str+=today.getMonth()+1;
str+="月";
str+=today.getDate();
str+="日";
str+="";
str+="星期";
str+=day[today.getDay()];
returnstr;
}
functionajaxPost(url,stateurl,data,info,loading){
varurl,stateurl,data,info,loading
createxmlhttp();
if(data==""||data==null)
{
//getMode
xmlhttp.open("get",url,true);
xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
xmlhttp.onreadystatechange=function(){checkState(stateurl,info,loading);};
xmlhttp.send(null);
}
else
{
//postMode
xmlhttp.open("post",url,true,"","");
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.onreadystatechange=function(){checkState(stateurl,info,loading);}
xmlhttp.send(data);
}
}
functioncheckState(stateurl,info,loadnews){
if(xmlhttp.readyState==4){
document.getElementById(info).innerHTML=loadnews;
if(xmlhttp.status==200){
varretext=xmlhttp.responseText.split("$");
document.getElementById(info).innerHTML=retext[1];
switch(retext[0]){
case"usreg":if(stateurl!=="")location.href=stateurl;
break;
case"uslogin":if(stateurl!=="")location.href=stateurl;
break;
case"active":location.href=retext[2];
break;
case"errinfo":returnfalse;
break;
default:document.getElementById(info).innerHTML=retext[0];
}
}
}
else{
document.getElementById(info).innerHTML=loadnews;
}
}
//AJAX_END
//运行代码
functionrunEx(cod1){
cod=document.getElementById(cod1)
varcode=cod.value;
if(code!=""){
varnewwin=window.open('','','');
newwin.opener=null
newwin.document.write(code);
newwin.document.close();
}
}
//复制代码
functiondoCopy2(ID){
if(document.all){
textRange=document.getElementById(ID).createTextRange();
textRange.execCommand("Copy");
alert('复制成功');
}
else{
alert("此功能只能在IE上有效")
}
}
//复制代码
functiondoCopy(obj){
varrng=document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
functiondoCopyUrl()
{
document.getElementById("CopyUrl").value=parent.location.href;
document.getElementById("CopyUrl").select();
document.execCommand("copy");
alert("网址成功复制到剪贴板!")
}
//另存代码
functiondoSave(obj){
varwinname=window.open('','_blank','top=10000');
winname.document.open('text/html','replace');
winname.document.writeln(obj.value);
winname.document.execCommand('saveas','','code.htm');
winname.close();
}
functionfindobj(n,d){
varp,i,x;
if(!d)d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length){
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(x!=d[n]&&d.all)x=d.all[n];
for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=findobj(n,d.layers[i].document);
if(!x&&document.getElementById)x=document.getElementById(n);
returnx;
}
functionsubmitonce(theform){
//ifIE4+orNS6+
if(document.all||document.getElementById){
//screenthrueveryelementintheform,andhuntdown"submit"and"reset"
for(i=0;i<theform.length;i++){
vartempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disableem
tempobj.disabled=true
}
}
}
functionopenScript(url,width,height){
varWin=window.open(url,"openScript",'width='+width+',height='+height+',resizable=1,scrollbars=yes,menubar=no,status=yes');
}
functionCheckAll(form){
for(vari=0;i<form.elements.length;i++){
vare=form.elements[i];
if(e.name!='chkall')e.checked=form.chkall.checked;
}
}
functionchkuserlogin(){
if(getcookie('userid')==''||getcookie('userid')==0||getcookie('username')==''){
returnfalse;
}
else{
returntrue;
}
}
functionchkcookieed(){
if(getcookie("username")!==""){
varurl="/ajax.asp?action=loginmenu";
url+="&random="+Math.random();
ajaxPost(url,null,null,"top_login","");
}
}
functionuserlogout(){
varurl="/AspCode.asp?getType=logout";
url+="&random="+Math.random();
ajaxPost(url,null,null,"top_login","正在退出...");
chkcookieed();
alert('欢迎再次光临阿里西西WEB开发社区...');
}
//Cookie解密
functionDecodeCookie(str)
{
varstrArr;
varstrRtn="";
strArr=str.split("a");
try{
for(vari=strArr.length-1;i>=0;i--)
strRtn+=String.fromCharCode(eval(strArr[i]));
}catch(e){
}
returnstrRtn;
}
functionisnumber(str){
vardigits="1234567890";
vari=0;
varstrlen=str.length;
while((i<strlen)){
varchar=str.charAt(i);
if(digits.indexOf(char)==-1)returnfalse;i++;
}
returntrue;
}
//检查非法字符
//str要检查的字符
//badwords非法字符&|<>=
functioncheckbadwords(str,badwords){
if(typeof(str)!="string"||typeof(badwords)!="string"){
return(false);
}
for(i=0;i<badwords.length;i++){
bad=badwords.charAt(i);
for(j=0;j<str.length;j++){
if(bad==str.charAt(j)){
returnfalse;
break;
}
}
}
returntrue;
}
functionswitchTag(tag,bar)
{
for(i=1;i<6;i++)
{
if("tag"+i==tag)
{
document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;
}else{
document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";
}
if("bar"+i==bar)
{
document.getElementById(bar).className="";
}else{
document.getElementById("bar"+i).className="hidebar";
}
document.getElementById("bar").className=bar;
}
}
functionswitchNew(fornum,showname,lname,newid)
{
for(i=1;i<fornum;i++)
{
if(lname+i==newid)
{
document.getElementById(newid).className=showname;
}else{
document.getElementById(lname+i).className="hidebar";
}
}
}
functionbgc(cssid){
switch(cssid){
case0:this.style.background='#FFFFFF';
break;
case1:this.style.background='#E8F5FE';
break;
case2:this.style.background='#FFFFDD';
break;
case3:this.style.background='#F2FDDB';
break;
case4:this.style.background='#FFE7F4';
break;
case5:this.style.background='#F7F7F7';
break;
default:this.style.background='#FFFFFF';
}
}
functionimgzoom(o){
if(event.ctrlKey){
varzoom=parseInt(o.style.zoom,10)||100;
zoom-=event.wheelDelta/12;
if(zoom>0){
o.style.zoom=zoom+'%';
}
returnfalse;
}else{
returntrue;
}
}
functionCheckAll(form)
{
for(vari=0;i<form.elements.length;i++)
{
vare=form.elements[i];
if(e.Name!="chkAll"&&e.disabled!=true)
e.checked=form.chkAll.checked;
}
}
functionaddfav(favtitle,favform,favid)
{
location.href="http://www.alixixi.com/account/user_Favorites.asp?url="+document.URL+"&favtitle="+favtitle+"&from="+favform+"&id="+favid;
}
functionmto(aid){
location.href="http://www.alixixi.com/account/user_post.asp?aid="+aid;
}
functionapost(url){
createxmlhttp();
//getMode
url+="&random="+Math.random();
xmlhttp.open("get",url,true);
xmlhttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");
//xmlhttp.onreadystatechange=function(){checkSeo();};
xmlhttp.send(null);
}
functioncheckSeo(){
varinfo='test';
varloadnews='正在加载';
if(xmlhttp.readyState==4){
document.getElementById(info).innerHTML=loadnews;
if(xmlhttp.status==200){
varretext=xmlhttp.responseText;
document.getElementById(info).innerHTML=retext;
}
}
else{
document.getElementById(info).innerHTML=loadnews;
}
}
functionsetstyle(sid){
if(sid!==''||sid!==null)
{
switch(parseInt(sid))
{
case1:
setcookie('ali_style',1,600000);
document.all.css.href='/css/style1.css';
break;
case2:
setcookie('ali_style',2,600000);
document.all.css.href='/css/style2.css';
break;
case3:
setcookie('ali_style',3,600000);
document.all.css.href='/css/style3.css';
break;
}
}
}
functionResumeError(){
returntrue;
}
window.onerror=ResumeError;
setstyle(getcookie('ali_style'));
//window.onload=setstyle(getcookie('ali_style'));