⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.js

📁 公司企业网站管理系统全站源码,用于企业内部对网站的管理
💻 JS
📖 第 1 页 / 共 2 页
字号:
	var xmlhttp = new HttpObj();
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState==4){
			if(xmlhttp.status==200){
				if (xmlhttp.responseXML){
					cache["boardlist"] = xmlhttp.responseXML.documentElement.getElementsByTagName("board");
				}
			}else{

			}
		}
	}
	xmlhttp.open("get",path+"index.asp?action=xml");	
	xmlhttp.send(null);
}

//论坛导航下拉菜单部分
function BoardJumpList(boardid,act){
		var MenuStr="";
		var LoadBoard,depth;
		if(typeof(cache["boardlist"])=="undefined"){
//			GetBoardXml(boardxml,'',boardid);
//			if (xslDoc.parseError){
//				if (xslDoc.parseError.errorCode!=0){
//					return "<div class=\"menuitems\">"+xslDoc.parseError.reason +"</div>";
//				}
//			}
//			cache["boardlist"] = xslDoc.documentElement.getElementsByTagName("board");
			GetBoardXml(boardxml,'',boardid);
		}
		var nodelist=cache["boardlist"];
		MenuStr+="<div class=\"menuitems\">";
		if (nodelist!=null){
			for(var i=0;i<nodelist.length;i++)
			{
				if (boardid>0&&boardid!=parseInt(nodelist[i].getAttribute("parentid"))){
					continue;
				}
					depth = nodelist[i].getAttribute("depth");
					LoadBoard = nodelist[i].getAttribute("boardid");
					boardtype = nodelist[i].getAttribute("boardtype");
					if (depth==0){
						var outtext="╋";
					}
					else{
						var outtext="";
						for (var j=0;j<(depth);j++)
						{
							if (j>0)
							{
								outtext+=" |"
							}
							outtext+="&nbsp;&nbsp;"
						}
						outtext+="├"
					}
				if (ISAPI_ReWrite==1){
					MenuStr+="<a href=\"index_"+LoadBoard+".html\">"+ outtext + boardtype +"</a><br/>";
				}else{
					
					MenuStr+="<a href=\"index.asp?boardid="+LoadBoard+"\">"+ outtext + boardtype +"</a><br/>";
				}
			}
			MenuStr+="</div>"
			return MenuStr;
		}else{
			return "<div class=\"menuitems\">Loading...</div>";
		}
}
//selected下拉列表选取表单()
function BoardJumpListSelect(boardid,selectname,fristoption,fristvalue,checknopost){
	if(typeof(cache["boardlist"])=="undefined"){
		GetBoardXmlbak(boardxml,'',boardid);
		if (xslDoc.parseError){
			if (xslDoc.parseError.errorCode!=0){
					return;
			}
		}
		cache["boardlist"] = xslDoc.documentElement.getElementsByTagName("board");
	}

	var sel = 0;
	var sObj = document.getElementById(selectname);
	if (sObj)
	{
		sObj.options[0] =  new Option(fristoption, fristvalue);
		var nodes = cache["boardlist"];
		if (nodes!=null)
		{
			for (var i = 0,k = 1;i<nodes.length;i++) {
				var t = nodes[i].getAttribute("boardtype");
				var v = nodes[i].getAttribute("boardid");
				if (v==boardid)
				{
					sel = k;
				}
				if (nodes[i].getAttribute("depth")==0){
					var outtext="╋";
				}
				else
				{
					var outtext="";
					for (var j=0;j<(nodes[i].getAttribute("depth"));j++)
					{
						if (j>0){outtext+=" |"}
						outtext+="  "
					}
					outtext+="├"
				}
				t = outtext + t
				t = t.replace(/<[^>]*>/g, "")
				t = t.replace(/&[^&]*;/g, "")
				if(checknopost==1 && nodes[i].getAttribute("nopost")=='1')
				{
						t+="(不许转移)"
				}
				sObj.options[k++] = new Option(t, v);
			}
			sObj.options[sel].selected = true;
		}
	}
}
//SELECT表单选取 Obj 表单名,VAL所选的值
function ChkSelected(Obj,Val)
{
	if (Obj)
	{
	for (i=0;i<Obj.length;i++){
		if (Obj.options[i].value==Val){
		Obj.options[i].selected=true;
		break;
		}
	}
	}
}

//单选表单选取 Obj 表单名,VAL所选的值
function chkradio(Obj,Val)
{
	if (Obj)
	{
	for (i=0;i<Obj.length;i++){
		if (Obj[i].value==Val){
		Obj[i].checked=true;
		break;
		}
	}
	}
}

// 修改编辑栏高度
function textarea_size(num,objname)
{
	var obj=document.getElementById(objname)
	if (obj){
		if (parseInt(obj.style.height)+num>20){
		obj.style.height = parseInt(obj.style.height)+num+"px";
		}
	}
}


function readCookie(name){
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		};
		return null;
	};
function createCookie(name,value,days){
		var expires = "";
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			expires = "; expires="+date.toGMTString();
		};
		document.cookie = name+"="+value+expires+"; path=/";
	};
	//图片自动调整的模式,1为按比例调整 ,2 按大小调整。
	var resizemode=1
function imgresize(o){
	 	if (resizemode==2 || o.onmousewheel){
	 	if(o.width > 500 ){
				o.style.width='500px';
			}
			if(o.height > 800){
				o.style.height='800px';
			}
		}else{
		var parentNode=o.parentNode.parentNode
		if (parentNode){
		if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
		}else{
		var parentNode=o.parentNode
		if (parentNode){
			if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
			}
		}
	}
	}
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}


//window.onload= new function()
//{
//	setTimeout('ActiveOnline()',2000);
//}

function boardbarover(obj)
{
	obj.className = obj.className.indexOf("mainbarhover")>0? "mainbar":"mainbar mainbarhover";
}


//Colour pallete top offset
function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent){
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetTop;
}

//Colour pallete left offset
function getOffsetLeft(elm) {
	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	while(mOffsetParent) {
		mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetLeft;
}
function postUrl(poststyle,act,bid,stype){
	var thisUrl ="post.asp?poststyle="+poststyle+"&action="+act+"&boardid="+bid+"&stype="+stype;
	return thisUrl; 
}

function close_postform(){
			var obj=document.getElementById("post_div");
			if (obj.style.display!="none"){
			obj.style.display="none";
			document.getElementById("post_iframe").src="";
			}
}

function post_topic(buttonElement,pstyle,act,bid,stype){
	var obj=document.getElementById("post_div");
	var buttonElement = document.getElementById("postbutton");
	if (pstyle!="1"){
		return this.location = postUrl(pstyle,act,bid,stype);
	}
	if (obj.style.display=="none")
		{
			//obj.style.top = (getOffsetTop(buttonElement)+buttonElement.offsetHeight)+"px";
			//obj.style.left = (getOffsetLeft(buttonElement)+buttonElement.offsetWidth)+"px";
			//obj.style.left = "20px";
			obj.style.display="block";
			document.getElementById("post_iframe").style.height="760px";
			document.getElementById("post_iframe").src=postUrl(pstyle,act,bid,stype);
	}else {
			obj.style.display="none";
			document.getElementById("post_iframe").src="";
	}
};


function ActiveOnline(boardid)
{
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			if(xmlhttp.status==200){
				//setTimeout('ActiveOnline()',300000);
				updateonline(xmlhttp.responseText);
		
			}else{
				//setTimeout('ActiveOnline()',20000);
			}
		}
	}
	xmlhttp.open("post","activeonline.asp?state="+escape(document.title.toString())+"&boardid="+boardid);	
	xmlhttp.send(null);
}

function updateonline(XMLstr)
{
	eval(XMLstr);
	var AllOnlie=document.getElementById("allonline");
	var UserOnlie=document.getElementById("useronline");
	var GuestOnlie=document.getElementById("guestonline");
	if(AllOnlie) AllOnlie.innerHTML=allonline.toString();
	if(UserOnlie) UserOnlie.innerHTML=useronline.toString();
	if(GuestOnlie) GuestOnlie.innerHTML=guestonline.toString();

}

//浮动窗口效果
var ShadeDiv = {
	objid : null,
	Shade : document.createElement('div'),
	ShadeID : 'Shade',
	width : 400,
	height : 300,
	Position : function(){
		if (!ShadeDiv.objid){
			ShadeDiv.objid = null;
			return;
		}
		var de = document.documentElement;
		var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
		var ch = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		if (self.pageYOffset) {
			var st = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
			var st = document.documentElement.scrollTop;
		} else if (document.body) {// all other Explorers
			var st = document.body.scrollTop;
		}
		if (window.innerHeight && window.scrollMaxY) {	
			var sh = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			var sh = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			var sh = document.body.offsetHeight;
		}
		ShadeDiv.Shade.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=60,finishOpacity=100,style=0)';
		ShadeDiv.Shade.style.height = (sh > ch ? sh : ch) + 'px';
		ShadeDiv.Shade.style.width = w + 'px';
		var pos = [], pw;
		pw = ShadeDiv.width;
		pos[0] = (w-pw)/2;
		pos[1] = (ch-(ShadeDiv.height || 300))/2 -100+st;
		//window.status="ch:"+ch+"st:"+st+"post[1]:"+pos[1]+"ShadeDiv.clientHeight"+ShadeDiv.objid.clientHeight;
		if (navigator.product && navigator.product == 'Gecko'){
			pw -= 40;
		}
		ShadeDiv.objid.style.width = ShadeDiv.width + 'px';
		ShadeDiv.objid.style.height = ShadeDiv.height + 'px';
		ShadeDiv.objid.style.left = pos[0] + 'px';
		ShadeDiv.objid.style.top = pos[1] + 'px';
		ShadeDiv.Shade.style.display = 'block';
		ShadeDiv.objid.style.display = 'block';
	},
	Show : function(id,w,h){
		ShadeDiv.height = parseInt(h);
		ShadeDiv.width = parseInt(w);
		ShadeDiv.Shade.id = ShadeDiv.ShadeID;
		ShadeDiv.objid = document.getElementById(id);
		document.body.insertBefore(ShadeDiv.Shade,null);
		ShadeDiv.Position();
	},
	Close : function(){
		if (ShadeDiv.objid==null){
			return;
		}
		ShadeDiv.Confirmed();
	},

	Confirmed : function() {
		ShadeDiv.objid.style.display = 'none';
		ShadeDiv.Shade.style.display = 'none';
		document.body.removeChild(ShadeDiv.Shade);
	}

}

function frameon(url,img){
	if (window == top){
		top.location.href = "index.asp?action=frameon&url="+escape(url);
	}else{
		top.location.href = url;
	}
}

function changeframeicon(img){
	if (!img){return false;}
	if (window == top){
		img.src = 'images/others/isleft.gif';
	}else{
		img.src = 'images/others/noleft.gif';

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -