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

📄 function.js

📁 vc-mfc编程实例 很简单的东西,以后回多传自己的东西
💻 JS
字号:
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}
 

function $F(element)
{
	 return $(element).value;
}
function $I(element)
{
	 return $(element).innerHTML;
}
function js_request(par)
{
	var thisLocation;
	var tmpStr1;
	var Arr2=new Array();
	var expKey;
	var outString;
	
	
	lct=window.location.toString();
	
	
	var tmpArr1=lct.split("?");
	tmpStr1=tmpArr1[tmpArr1.length-1];
	Arr2=tmpStr1.split("&");
	for (i=0;i<Arr2.length;i++)
	{
		
		expKey=eval("/^"+par+"\\s*\\=/");
		if (expKey.test(Arr2[i]))
		{
			
			outString=Arr2[i].replace(expKey,"");
			outString=outString.replace(/\%20/g," ");
			outString=unescape(outString);
			return outString;
		}

	}
	return "";
}

function Request(par)
{
	var thisLocation;
	var tmpStr1="";
	var Arr2=new Array();
	var expKey;
	var outString;
	lct=window.location.toString();
	lct=unescape(unescape(lct));
	lct=lct.replace("[|L]","\/")
	lct=lct.replace("[|R]","\\")
	var tmpArr1=lct.split("?");
	for (i=1;i<tmpArr1.length;i++)
	{
		tmpStr1+=tmpArr1[i]+"?";
	}
	tmpStr1=tmpStr1.substr(0,tmpStr1.length-1)
	Arr2=tmpStr1.split("&");
	for (i=0;i<Arr2.length;i++)
	{
		expKey=eval("/^"+par+"\\s*\\=/");
		if (expKey.test(Arr2[i]))
		{
			
			outString=Arr2[i].replace(expKey,"");
			outString=outString.replace(/\%20/g," ");
			return outString;
		}

	}
	return "";
}

////////////////function pop message box
function RIT_popMsg(url,width,height,buttontype,msg,msgtype)
{    
     //alert(msg)
	 //return
	
	var isDoingThing=window.external.IsPendClose()
	window.external.PendClose(false);
	window.external.SetStaticData(msg);
	var returnStr;
	if (msgtype!="" && msg!="")
	{
		if (msgtype=="confirm")
		{
			//window.external.SetStaticData("");
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			return returnStr;
		}
		if (msgtype=="okcancel")
		{
			//window.external.SetStaticData("");
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			return returnStr;
		}
		else if (msgtype=="erase")
		{
			window.external.SetStaticData("");
			window.external.Navigate("mainui/ediscmsg.htm?pa="+escape(msg), 355, 228);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			return returnStr;
		}
		else if(msgtype=="tryagain")
		{
			//window.external.SetStaticData("");
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			returnStr=window.external.GetStaticData();
			window.external.PendClose(isDoingThing);
			return returnStr;	
		}
		else
		{
			window.external.Navigate("mainui/alertmsg.htm?msg=a&width="+width+"&height="+height+"&msgtype="+msgtype, width, height);
			//window.external.Navigate("mainui/about.htm",320,420)
		}
	}
	else
	{
		window.external.Navigate(url, width, height);
	}
	window.external.PendClose(isDoingThing);
	return "";
}
//////////////////////////////////////

function GetFilepath(Filename,opentype)
{    
    var ProductId=window.external.GetProductID();
	var filedislog;
	if(ProductId.toString(16)=="4020502")
		filedislog= new ActiveXObject("FileBrowse_vhd.FileBrowse1.1");
	else
		filedislog= new ActiveXObject("FileBrowse.FileBrowse1.1");
	
	if(opentype=="folder")
	{
		
		return filedislog.FolderBrowse();
	}
	else
	{
		if (!opentype){
			var returnvalue = filedislog.FileBrowse(opentype,Filename);
			if (Filename.split("|")[1].substr(1,4).toLowerCase() == returnvalue.substr(returnvalue.length-4,4).toLowerCase()){
				returnvalue = returnvalue.substr(0,returnvalue.length-4);
			}
			return returnvalue;
		}else{
			var returnvalue = filedislog.FileBrowse(opentype,Filename);
			return returnvalue;
		}
	} 	
		
}





/////////////////////
//Cut string(get short string)
//////////////////////
function getCuttedString(str,len,leftLen)
{
	if (str.length<=len)
	{
		return str;
	}
	else
	{
		rightLen=len-leftLen;
		leftStr=str.substr(0,leftLen);
		rightStr=str.substr(str.length-rightLen,rightLen)
		return (leftStr+"..."+rightStr);
	}
}
//////////////////////////////////////////////////
////////////summary function ///////////////
function SetSummaryBack(divObj) {
	var clickDivID = divObj.id;
	if ( clickDivID == "Summary_Summary" ) {
		$("Summary_Summary").style.background="url(images/summary_click_background.gif)";
		window.location="summary.htm";
	}
	else {
		$("Summary_Summary").style.background="url(images/summary_unclick_background.gif)";
	}
	if ( clickDivID == "Summary_Jobs" ) {
		$("Summary_Jobs").style.background="url(images/summary_click_background.gif)";
		window.location="Jobs.html";
	}
	else {
		$("Summary_Jobs").style.background="url(images/summary_unclick_background.gif)";
	}
	if ( clickDivID == "Summary_LogView" ) {
		$("Summary_LogView").style.background="url(images/summary_click_background.gif)";
		window.location="ViewLogs.htm";
	}
	else {
		$("Summary_LogView").style.background="url(images/summary_unclick_background.gif)";
	}
}
////////////summary function ///////////////
var xmlStringAgent=function()
{
	this.attachVar=function(name,value)
	{
		value = value.replace(/\n/g,"").replace(/\r/g,"").replace(/\"/g,"\\\"");
		eval("this."+name+"=\""+value+"\"");
	}
}
function analyseXml(str)
{
	var innerStr;
	var XSA=new xmlStringAgent();
	str=str.replace(/^\s+/,'');
	str=str.replace(/\s+$/,'');
	var arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	while (arrtmp!=null)
	{
		str=str.replace(/\<([\w\s]+)\>[^\<]+\<\/\1\>/,"");
		XSA.attachVar(arrtmp[1],arrtmp[2]);
		arrtmp=str.match(/\<([\w\s]+)\>([^\<]+)\<\/\1\>/);
	}
	return XSA;
}
var XMLDOM = function(loadxml,parentNode)
{
	this.xmlDoc = new ActiveXObject("Microsoft.xmldom");
	this.xmlDoc.loadXML(loadxml);
	this.GetNode=function(nodename)
	{
		if(parentNode.length>0)
		{
			nodename=parentNode+"/"+nodename;
		}
		var rv=this.xmlDoc.selectSingleNode(nodename).text;
		return rv;
	}
	this.SetNode=function(nodename,value)
	{
		if(parentNode.length>0)
		{
			nodename=parentNode+"/"+nodename;
		}
		this.xmlDoc.selectSingleNode(nodename).text=value;
		//alert(value);
	}
	this.getXmlString=function()
	{
		return this.xmlDoc.xml;
	}
	//this.xml=this.xmlDoc.xml;
}


///////////////set process location flag
//////////////set presskey down event////////////
var focusInTextFlag = false;
function SetAllInputTextEvent() {
	//document.attachEvent("onclick",getCloseTopMenuFunction(null));
	document.attachEvent("onkeydown", function() {return OnBodyKeyDown(event.keyCode);});
	var inputObject = document.getElementsByTagName("input");
	var i;
	for (i=0;i<inputObject.length;i++) {
		inputObject[i].onfocus = function() {
			focusInTextFlag = true;
		}
		inputObject[i].onblur = function() {
			focusInTextFlag = false;
		}
	}
}
function OnBodyKeyDown(key)
{
	switch (key) {
		case 8:
			if ( !focusInTextFlag ) { return false; }
			break;
		case 13:
			OnEnterKeyPress();
			return key;
			break;
		default:
			return key;
	}
}
function GetnameFormPath(filepath)
{
	var arr = filepath.match(/\w\:[\/]*[^\?]*[\/]+([^\/]+)/);
	return arr[1];
}

function disableBack(){
	if (event.keyCode == 8) return false;
}

⌨️ 快捷键说明

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