guide.js

来自「学生选课系统 赶快来下载啊啊好东西 呵呵啊啊 啊啊啊啊啊」· JavaScript 代码 · 共 116 行

JS
116
字号
//提交
function doAction(action){
	//数据校验
	//var type = document.all("type").value;
	var type = getAllElements("type")[0].value;
	if(type=="1"){
		if(!check1()) return;
	}else{
		if(!check2()) return;
	}
	setValue("_action",action);
	document.forms[0].submit();
}
//应用类型改变的动作
function setType(action){
	setValue("_action",action);
	document.forms[0].submit();
}
//自动设置主表对应的编号
function set21(head){
	if(head=="") return;
	head = getHead(head);
	/*
	setValue("viewid1","_"+head);
	setValue("unitid1","_"+head+"_search");
	setValue("unitid2","_"+head+"_list");
	setValue("unitid3","_"+head+"_detail");
	*/
	setValue("viewid1",formatViewId(head));
	setValue("unitid1",head+"_SEARCH");
	setValue("unitid2",head+"_LIST");
	setValue("unitid3",head+"_DETAIL");

}
//自动设置从表对应的编号
function set22(head){
	if(head=="") return;
	head = getHead(head);
	/*
	setValue("viewid2","_"+head);
	setValue("unitid4","_"+head+"_list");
	*/
	setValue("viewid2",formatViewId(head));
	setValue("unitid4",head+"_LIST");
}
//自动设置单表对应的编号
function set1(head){
	if(head=="") return;
	head = getHead(head);
	/*
	setValue("viewid1","_"+head);
	setValue("viewid2","_"+head+"_detail");
	setValue("unitid1","_"+head+"_search");
	setValue("unitid2","_"+head+"_list");
	setValue("unitid3","_"+head+"_detail");
	*/
	setValue("viewid1",formatViewId(head));
	setValue("viewid2",formatViewId(head+"_DETAIL"));
	setValue("unitid1",head+"_SEARCH");
	setValue("unitid2",head+"_LIST");
	setValue("unitid3",head+"_DETAIL");
}

function formatViewId(head){
	var index = head.indexOf("_");
	var result = head.substring(0,index) + "V" + head.substring(index);
	return result;
}

function getHead(head){
//	head = head.toLowerCase();
	head = head.toUpperCase();
	var index = head.indexOf("epod_");
	if(index==0){
		head = head.substring(5);
		var re = /_/g;
		head = head.replace(re,"");
	}
	return head;
}
//单表数据校验
function check1(){
	var msg = "";
	if(getValue("table1")=="") msg="表名不能为空!\n";
	if(getValue("viewid1")=="") msg+="视图1编号不能为空!\n";
	if(getValue("viewid2")=="") msg+="视图2编号不能为空!\n";
	if(getValue("unitid1")=="") msg+="查询单元编号不能为空!\n";
	if(getValue("unitid2")=="") msg+="列表单元编号不能为空!\n";
	if(getValue("unitid3")=="") msg+="明细单元编号不能为空!\n";

	if(msg!=""){
		alert(msg);
		return false;
	}
	return true;
}
//主从表数据校验
function check2(){
	var msg = "";
	if(getValue("table1")=="") msg="主表不能为空!\n";
	if(getValue("table2")=="") msg="从表不能为空!\n";
	if(getValue("viewid1")=="") msg+="主表视图编号不能为空!\n";
	if(getValue("viewid2")=="") msg+="从表视图编号不能为空!\n";
	if(getValue("unitid1")=="") msg+="主表查询单元编号不能为空!\n";
	if(getValue("unitid2")=="") msg+="主表列表单元编号不能为空!\n";
	if(getValue("unitid3")=="") msg+="主表明细单元编号不能为空!\n";
	if(getValue("unitid4")=="") msg+="从表列表单元编号不能为空!\n";

	if(msg!=""){
		alert(msg);
		return false;
	}
	return true;
}

⌨️ 快捷键说明

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