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

📄 system.js

📁 点餐系统 非常好的 jsp mysql 我也是别人那里下载来的
💻 JS
📖 第 1 页 / 共 2 页
字号:
/**
 * @author luocp
 * ?2004 ThinkerSoft Corporation. All rights reserved
 * 
 * 系统JavaScript文件,共用JS程序集合
 * 
 **/

//==========================================================
//		系统程序路径
//==========================================================

function system_path()
{
	var path="";
	this.path=path;
	this.UserServlet= path+"/servlet/com.thinkersoft.Servlet";
}
//外部使用的全局变量
systemPath=new system_path();


//设置按入回车键后进入下一行
//list为记录顺序ID的列表
function putEnterToNext(list,ev){	
	try{
		for(var i =0;(i+1) < list.length;i ++){
			var temp = eval(list[i]);
			temp._nextObj = list[i+1];
			//temp.onkeydown = _putEnterToNext;
		}
		if(typeof(ev)!= "undefined"){
			var temp = eval(list[i]);
			temp._nextObj = ev;
		}

	}catch(e){
		alert("putEnterToNext Error:"+e);
		return;
	}
	if(document.body.onkeydown != null){
		_temp_putEnterToNext = document.body.onkeydown;
		document.body.onkeydown = new Function("_temp_putEnterToNext();\n_putEnterToNext();");
	}else{
		document.body.onkeydown = _putEnterToNext;
	}
}
function _putEnterToNext(){
	
	try{
		var obj = event.srcElement;
		//alert(obj.outerHTML)
		if(event.keyCode != 13)return;
		var nextObj = obj._nextObj;
		if(nextObj.indexOf("()") != -1){
			eval(nextObj);
		}else{
			nextObj = eval(nextObj);
			nextObj.focus();
		}
	}catch(e){}
}


var callServerGetTest=false;
document.write("<div id='postdiv' style='display:none'></div>");
if(callServerGetTest==true)
	document.write("<iframe name='buffer' frameborder=1 width=20 height=20></iframe>")
else
	document.write("<iframe name='buffer' frameborder=0 width=0 height=0 style='display:none'></iframe>");

//外部程序用
function callServerGet(program,act,param,name){
	var bufferName=(name == null)?"buffer":name;
	if(typeof(act) == "undefined")alert("访问服务器必须指定动作");
	isTimeout = false;
	//==================
	var tempStr ='<FORM METHOD="post" ACTION="'+ program +'"target="'+bufferName+'" name="posts" style="display:none">\n';
	tempStr += '<input type="hidden" name="action" value="'+act+'">\n'
	var s = new Array;
	param = param.substring(param.indexOf("&")+1,param.length);
	for(var i = 0;param.indexOf("&") != -1;i++)
	{
		s[i] = param.substring(0,param.indexOf("&"));
		param = param.substring(param.indexOf("&")+1,param.length);
	}
	if(param!=""&&typeof(param)!="undefined")s[s.length]=param;
	for(i = 0;i < s.length;i ++)
	{
		tempStr += '<TEXTAREA name="'+s[i].substring(0,s[i].indexOf("="))+'">'+s[i].substring(s[i].indexOf("=")+1,s[i].length)+'</TEXTAREA>\n';
	}
	tempStr += '</FORM>';
	postdiv.innerHTML = tempStr;
	//postdiv.style.top=3000;
	posts.submit();
	//==================
}

//使用get方式访问URL请求target=windowName;
function getModeRequest(target,url,act){
	var nowTime = new Date().getTime();
	var str = url+"?"+act+"&"+nowTime;
	//target.location = str;
	window.open(str,target);
	//document.title = "jsRequest:"+str;
}

document.write("<script id=jsRequestArea src=><"+"/script>");
function jsRequest(url,act){//通过javascript访问get方式
	var nowTime = new Date().getTime();
	var str = url+"?"+act+"&"+nowTime;
	str = replaceAll(str,"+","+");


	jsRequestArea.src = str;
	//alert(jsRequestArea.src)
	//document.title = "jsRequest:"+str;
}

//表单文本域不能为空//格式new Array("inputObj,alertName",.....)//inputObj例如:form.password;alertName例如:用户密码
function formInputNoNull(list){
	try{

	for(var i =0;i < list.length;i ++){
				
		var temp = list[i].split(",");
		var obj = eval(temp[0]);
		
		if(obj.value == ""){
			alert(temp[1]+"域不能为空");
			obj.focus();
			return false;
		}
	}
	return true;
	}catch(e){alert("formInputNotNull(list) Error:"+e)}
}

function formInputReplace(form,reD){//替换表单中域的reD数组里的所有字符串reD=new Array("a=b","c=d")
	for(var i =0;i < form.all.length;i ++){
		try{
		if(form(i).tagName != "INPUT" && form(i).tagName != "TEXTAREA"){
			continue;
		}

		var value = form(i).value+"";
		if(value == "")
			continue;

		for(var j =0;j < reD.length;j ++){
//				alert(reD[i])

				var reDs = reD[j].split("=");
				value = replaceAll(value,reDs[0],reDs[1]);
		}
		if(value != form(i).value)
			form(i).value = value;
		}catch(e){}
	}
}

//替换window.open()功能,解决<a href=javascript:window.open>会返回对象
function windowOpen(file,target,p){
	if(typeof(p) != "undefined")
		window.open(file,target,p);
	else if(typeof(target) != "undefined")
		window.open(file,target);
	else
		window.open(file);
}


//用window.open实现对话框模式,替换showModalDialog的一些安全模式
var bodyonfocus;
var showDialogWindowObj;
function showDialogWindowPost(Url,Features){
	Features = _setShowDialogWindowFeatures(Features);
	showDialogWindowObj = window.open("about:blank","showDialogWindowObj","status=1,"+Features);
	bodyonfocus = document.body.onfocus;
	var program = Url.split("?");
	callServerGet(program[0],"","&"+program[1],"showDialogWindowObj");
	document.body.onfocus = showDialogWindow_onfocus;

}
function showDialogWindow(Url,Features){
	Features = _setShowDialogWindowFeatures(Features);
	showDialogWindowObj = window.open(Url,"_blank","status=1,"+Features);
	bodyonfocus = document.body.onfocus;
	document.body.onfocus = showDialogWindow_onfocus;
	return showDialogWindowObj;
}
function _setShowDialogWindowFeatures(Features){	//将窗口至中
	var height;
	var width;
	try{
	var a = Features.split(",");
	for(var i = 0;i < a.length;i ++){
		var d = a[i].split("=");
		if(d[0] == "width")
			width = d[1];
		else if(d[0] == "height")
			height = d[1];
	}
	Features += ",top="+(screen.height-height-50)/2+",left="+(screen.width-width-10)/2
		return Features;
	}catch(e){
		alert("showDialogWindow()的Features参数有误,请参照window.open的Features");
		return "";
	}
}
function showDialogWindow_onfocus(){
	try{
		showDialogWindowObj.document.body.focus();
	}catch(e){
		document.body.onfocus = bodyonfocus;
	}
}

function setMaxWindow(){	//最大化窗口
	self.moveTo(-4,-4);
	self.resizeTo(screen.availWidth+8,screen.availHeight+8) ;
}

//实现模拟多窗口操作界面
function multi_windows(name){//类型
	this.name = name;
	this.init = multi_windows_init;
	this.open = insert_window;
	backObj = new Array(1000);//访问对象的顺序
	this.backObj = backObj;
	index = backObj.length-1;
	this.index = index;
	this.show_window = show_window_obj;
	this.close_window = close_window_obj;

}

function multi_windows_init(){//初始化
	var obj = "mwa_"+new Date().getTime();
	document.write("<table width=100% height=100% border=0 cellspacing=0 cellpadding=0 id="+obj+"><tr><td valign=top colspan=3></td></tr><tr style='background-image:url(/images/tr_bg.gif)'><td height=31 width=20 style='cursor:hand'  onmouseover='windowScrollS=true;windowScrollRight(this.parentElement.cells(1).all(0))' onmouseout='windowScrollS=false'><img src=/images/scroll_r.gif></td><td  width=100% noWrap><div style='height:31;overflow:hidden;width:100%' id=s"+obj+"></div></td><td height=31 width=20 align=right onmouseover='windowScrollS=true;windowScrollLeft(this.parentElement.cells(1).all(0))' onmouseout='windowScrollS=false' style='cursor:hand' ><img src=/images/scroll_l.gif></td></tr></table>");
	this.obj = eval(obj);
}
var windowScrollS = false;
function windowScrollLeft(obj){//右移选择栏
	if(!windowScrollS)return;
	obj.scrollLeft += 3;
	setTimeout("windowScrollLeft("+obj.id+")",50);
}
function windowScrollRight(obj){//左移选择栏
	if(!windowScrollS)return;
	obj.scrollLeft -= 3;
	setTimeout("windowScrollRight("+obj.id+")",50);
}
function insert_window(url,text,remark,ico){//新建立窗口

	if(typeof(url) == "undefined" || typeof(text) == "undefined" || typeof(remark) == "undefined"){
		alert("multi_windows_open(url,text,remark,ico).Error()");
	}
	var obj = this.obj.rows(0).cells(0);
	for(var i =0;i < obj.all.length;i ++){
		//alert("|"+obj.all(i).text +"|"+ " "+text+" "+"|")
		if(obj.all(i).text == text){//已经存在窗口,显示此窗口
			this.show_window(text);
			return;
		}
	}
	this.obj.rows(0).cells(0).insertAdjacentHTML("BeforeEnd","<iframe text="+text+" style='display:none' width=100% height=100% src='"+url+"' frameborder=0></iframe>");
	this.obj.rows(1).cells(1).all(0).insertAdjacentHTML("BeforeEnd","<span onclick='"+this.name+".show_window(\""+text+"\")' onmouseover='status=\""+remark+"\"'  onmouseout='status=\"\"' style='font-size:13;cursor:default;	width:113;height:100%;'><span>&nbsp;</span><span style='height:100%;position: relative;top:5'>"+text+"</span><img style='cursor:hand;position: relative;top:-8'title='close'onclick='"+this.name+".close_window(\""+text+"\")' src='/images/close_button.gif'><span>&nbsp;</span></span>");
	this.show_window(text);
}

function show_window_obj(text){//显示窗口
	//设置历史记录
	this.backObj[this.index] = text;
	this.index -- ;
	var st = false;
	//设置选择栏显示
	var obj = this.obj.rows(1).cells(1).all(0);
	for(var i =0;i < obj.all.length;i += 5){
		if(obj.all(i).innerText == " "+text+" "){
			obj.all(i).style.backgroundImage = "url(/images/open_bg.gif)";
			st = true;
		}else{
			obj.all(i).style.backgroundImage = "url(/images/close_bg.gif)";
		}
	}

	//设置窗口显示
	obj = this.obj.rows(0).cells(0);
	for(var i =0;i < obj.all.length;i ++){

⌨️ 快捷键说明

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