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

📄 global.js

📁 教师评估系统
💻 JS
字号:
function ChkNaN(obj) {
if(isNaN(obj.value)) {obj.value='0';}
}

function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name!='chkall'&&e.type=="checkbox"){
e.checked = form.chkall.checked;
}
}
}

//菜单
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=18	//菜单距连接文字顶端距离

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all

function showmenu(e,vmenu,mod){
which=vmenu;
menuobj=document.getElementById("popmenu");
menuobj.thestyle=menuobj.style;
menuobj.innerHTML=which;
menuobj.contentwidth=menuobj.offsetwidth;
eventX=e.clientX;
eventY=e.clientY;
var rightedge=document.body.clientwidth-eventX;
var bottomedge=document.body.clientheight-eventY;
var getlength;
	if (rightedge<menuobj.contentwidth){
		getlength=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
	}else{
		getlength=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
	}
	menuobj.thestyle.left=getlength+'px'
	if (bottomedge<menuobj.contentheight&&mod!=0){
		getlength=ie4? document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23 : ns6? window.pageYOffset+eventY-menuobj.contentheight-10 : eventY-menuobj.contentheight
	}	else{
		getlength=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
	}
menuobj.thestyle.top=getlength+'px'
menuobj.thestyle.visibility="visible"
}
function ie_y(e){  
var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}  

function highlightmenu(e,state){
if (document.all)
		source_el=event.srcElement
	else if (document.getElementById)
		source_el=e.target
	if (source_el.className=="menuitems"){
		source_el.id=(state=="on")? "mouseoverstyle" : ""
	}
	else{
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
			}
		}
	}
}

function hidemenu(){if (window.menuobj)menuobj.thestyle.visibility="hidden"}
function dynamichide(e){if ((ie4||ns6)&&!menuobj.contains(e.toElement))hidemenu()}

document.onclick=hidemenu
document.write("<div class=menuskin id=popmenu onmouseover=highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event)></div>")
// 菜单END

function VerifyText(obj,value,button){
var buttonCtrl = document.getElementById(button);
if (obj.value == "" || obj.value == value){buttonCtrl.disabled = "disabled";
}else{buttonCtrl.disabled = "";}
if (obj.value==""){obj.value=value;buttonCtrl.disabled = "disabled";}
}

function loadtree(ino,id){
switch (id) {
case "0" :
url="Load.asp?menu=ForumTree&id="+ino+"";
menuname="temp"+ino+"";
break;
case "3" :
url="Load.asp?menu=ForumList";
menuname="tempk";
break;
case "7" :
url="Load.asp?menu=AdminBar";
menuname="adminbar";
break;
}
XmlGet(url,menuname);
}

function GetXmlDom() {
if (window.ActiveXObject) {//IE浏览器
return new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation && document.implementation.createDocument) { //其它浏览器
return document.implementation.createDocument("","",null);
}
}

function GetXmlHttp(){
var xmlhttp = null;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
if (xmlhttp) return xmlhttp;
}

function GetNodeValue(objXmlElement){
if(window.ActiveXObject) {	//IE浏览器
return objXmlElement.text;
}
else if(window.XMLHttpRequest) {  //其它浏览器
try {
return objXmlElement.firstChild.nodeValue;
}
catch(ex) {
return "";
}
}
}

function ShowMenuList(){
var XmlDom = GetXmlDom();
var SubMenuStr,MenuNode;
var ShowMenuList = "";
XmlDom.async = false;
XmlDom.load("Inc/Menu.xml");
var XmlDomRoot = XmlDom.documentElement;
var CategoryNode = XmlDomRoot.getElementsByTagName('Category');
for (var i=0; i<CategoryNode.length; i++) {
SubMenuStr="";
MenuNode = CategoryNode[i].getElementsByTagName('Menu');
for (var j=0; j<MenuNode.length; j++){
SubMenuStr+="<div class=menuitems><a href="+MenuNode[j].getAttributeNode("Url").nodeValue+">"+GetNodeValue(MenuNode[j])+"</a></div>";
}
ShowMenuList+=" | <a href="+CategoryNode[i].getAttributeNode("Url").nodeValue+" onmouseover=\"showmenu(event,'"+SubMenuStr+"')\">"+CategoryNode[i].getAttributeNode("Name").nodeValue+"</a>";
}
return ShowMenuList;
}

function loadThreadFollow(ino,Online){
var targetDiv =document.getElementById("follow" + ino);
if (targetDiv.style.display!='block'){
targetDiv.innerHTML="正在加载...";
XmlGet("Load.asp?menu=ForumVisit&Forumid="+Online+"","follow"+ino);
targetDiv.style.display="block";
}else{
targetDiv.style.display="none";
}
}

function MenuOn(sName){
var menu = document.getElementById(sName);
if (menu.style.display == 'none') {
menu.style.display = '';
}else{
menu.style.display = 'none';
}
}

function log_out(){
h = document.getElementsByTagName("html")[0];
h.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('你确定要退出?'))
{return true;
}else{
h.style.filter = "";
return false;
}
}

function ShowSysTop(UserName,UserRoleID,NewMessage){
ShowTop();
document.write("<script type='text/javascript' src='Inc/Verify.js'></script>");
var menu = document.getElementById("menu");
if (UserName==''){
 menu.innerHTML += "<b>游客</b> <a onclick=\"return ShowModal('登录论坛','Login.asp');\">登录</a> | <a onclick=\"return ShowModal('注册新用户','Reg.asp');\">注册</a> | <a href=Modification.asp>忘记密码</a> | <a href=Search.asp>搜索</a> | <a href=Help.asp>帮助</a>";
}else{
 menu.innerHTML += "<b>"+UserName+"</b>";
 menu.innerHTML += " <a href=Login.asp?menu=out onclick=\'return log_out()\'>退出<\/a> |";
 menu.innerHTML += " <a href=MyPanel.asp?menu=Msg>短讯息</a> ";
 if (NewMessage>0){menu.innerHTML += "<span class='or' onclick=\"return ShowModal('提示','Load.asp?menu=PromptMsg');\">(新消息)</span>";}
 menu.innerHTML += " | <a href=\"Search.asp\">搜索</a>";
 menu.innerHTML += ShowMenuList();
 menu.innerHTML += " | <a href=\"Help.asp\">帮助<\/a>";
 if (UserRoleID=='1'||UserRoleID=='2') {
 menu.innerHTML += " | <span id=adminbar><a onmouseover=loadtree('','7') href=#>管理</a></span>";
 }
}
}

function ShowPostImg(f,t,p,r,v){
if (p==1) {document.write("<a href='NewTopic.asp?Fid="+f+"'><img src='"+HpImgPath+"Post.gif'></a>&nbsp;");}
if (r==1) {document.write("<a href='ReTopic.asp?Threadid="+t+"'><img src='"+HpImgPath+"reply.gif'></a>&nbsp;");}
if (v==1) {document.write("<a href='NewTopic.asp?Fid="+f+"&Poll=1'><img src='"+HpImgPath+"vote.gif'></a>");}
}

function ShowForumImg(num){
var isnew;
var de;
if (num>0) {
isnew="new";
de="有新帖的版块";
}else{
isnew="nonew";
de="没有新帖的版块";
}
document.write("<img src='"+HfImgPath+"forum_"+isnew+".gif' alt='"+de+"' />");
}

function ShowModal(title,Url){
var x=GetXmlHttp();
var d=document.createElement("div");
var PopupDiv=document.getElementById("Popup");
PopupDiv.innerHTML="";
d.id="Shade";
x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200){PopupDiv.innerHTML="<div class='tb dt' style='width:100%;'><div id='tt'><span class='fl'>"+title+"</span><span class='fr al hand' onclick='javascript:ShadeDiv.Close();'>关闭&nbsp;</span></div>"+x.responseText+"</div>";}}
x.open("GET",Url,true);
x.send();
ShadeDiv.Show('Popup',500,1);
//return false;
}

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);
//top.location.reload();
}
}

function XmlGet(Url,spanID){
var x=GetXmlHttp();
var target = document.getElementById(spanID);
x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200 && target){target.innerHTML=x.responseText;}}
x.open("GET",Url,true);
x.send();
}

function XmlReturn(Url){
var x=GetXmlHttp();
x.open("GET",Url,true);
x.send();
return x.responseText;
}


function XmlPost(FormName,spanID){
var x=GetXmlHttp();
var ID = document.getElementById(spanID);
var encodedData=""
if (document.forms.length > 0 && FormName) {
var form = document.forms[FormName];
var Url=form.getAttributeNode("action").value;
x.open("POST",Url);
x.setRequestHeader("REFERER", location.href);
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200 && ID){ID.innerHTML=x.responseText;}}
for (var i = 0; i < form.length; ++i) {
var element = form.elements[i];
if (element.name) {
var elementValue = null;
if (element.nodeName == "INPUT") {
var inputType = element.getAttribute("TYPE").toUpperCase();
if (inputType == "TEXT" || inputType == "PASSWORD" || inputType == "HIDDEN") {
elementValue = escape(element.value);
} else if (inputType == "CHECKBOX" || inputType == "RADIO") {
if (element.checked) {
elementValue = escape(element.value);
}
}
} else if (element.nodeName == "SELECT" || element.nodeName == "TEXTAREA") {
elementValue = escape(element.value);
}
if (elementValue) {
if(encodedData==""){
encodedData = element.name + "=" + encodeURIComponent(elementValue);
}
else{
encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue);
}
}
}
}
}
x.send(encodedData);
}

⌨️ 快捷键说明

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