www.gusucode.com > 25175 学生同学录管理系统 2007 build 1231D源码程序 > admin/inc/admin_stuid.js

    function deleteAllOptions(sel){sel.options.length=0;}

function checkinfos(x){
	var strljid = $("select")[0].options[$("select")[0].selectedIndex].value*1;
	var strColid = $("select")[1].options[$("select")[1].selectedIndex].value*1;
	var strproid = $("select")[2].options[$("select")[2].selectedIndex].value*1;
	
	if (x=="lj")
	{
		if (strljid!=0 && strColid!=0 && strproid!=0){
			fillSel("请选择...",$("select")[3]);
			postalls(strljid,strColid,strproid);
		}else{
			$("span")[1].innerHTML="";
			fillSel("请选择...",$("select")[3]);
		}

	}else if (x=="Col"){
		if (strColid!=0){
			fillSel("请选择...",$("select")[2]);
			postCols(strColid);
		}else{
			$("span")[0].innerHTML="";
			$("span")[1].innerHTML="";
			fillSel("请选择...",$("select")[2]);
			fillSel("请选择...",$("select")[3]);
		}

	}else if (x=="pro"){
		if (strproid!=0 && strljid!=0){
			fillSel("请选择...",$("select")[3]);
			postalls(strljid,strColid,strproid);
		}else{
			
			$("span")[1].innerHTML="";
			fillSel("请选择...",$("select")[3]);

		}
	}
	
}
	

function postCols(Col_id){
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;

			Colsid_result(data);	
			}
		else{
			fillSel("文件传输失败!",$("select")[2]);
			$("span")[0].innerHTML="<img src='../images/reg_yesno.gif' alt='文件传输失败!'>";
			}
		}
	else{
		fillSel("正在刷新...",$("select")[2]);
		$("span")[0].innerHTML="<img src='images/loading.gif' alt='正在刷新专业下拉列表......'>";
		}
	}
	var BaseURL="admin_res_check.asp"
	var url = BaseURL + "?timeStamp=" + new Date().getTime();
	xmlhttp.open("post", url, true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=gb2312');
	xmlhttp.send("Col_id="+escape(Col_id));	
}
function Colsid_result(data){
	
	var pronames
	var data_arr
	if(data!="0"){
		data = data.split('%%');
			$("select")[2].options.length=0;
			for(data_i=0;data_i<data.length;data_i++){
				data_arr=data[data_i];
				data_arr=data_arr.split('||');
				$("select")[2].options[data_i] = new Option(data_arr[1],data_arr[0]);
				}
			$("select")[2].selectedIndex = data_i;
			addOption(0,$("select")[2]);
			setSel("请选择...",$("select")[2])
		$("span")[0].innerHTML="<img src='../images/reg_yesok.gif' alt='专业下拉列表更新成功!'>";
		checkpro();
	}else{
		fillSel("当前还没有专业",$("select")[2]);
		$("span")[0].innerHTML="<img src='../images/reg_yesno.gif' alt='专业下拉列表为空,请添加专业!'>";
	}
}


function postalls(lj_id,Col_id,pro_id){
	var xmlhttp;
	try{
		xmlhttp=new XMLHttpRequest();
		}
	catch(e){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			var data=xmlhttp.responseText;

			allsid_result(data);	
			}
		else{
			fillSel("文件传输失败!",$("select")[3]);
			$("span")[1].innerHTML="<img src='../images/reg_yesno.gif' alt='文件传输失败!'>";
			}
		}
	else{
		fillSel("正在刷新...",$("select")[3]);
		$("span")[1].innerHTML="<img src='images/loading.gif' alt='正在刷新班级下拉列表......'>";
		}
	}
	var BaseURL="admin_res_check.asp"
	var url = BaseURL + "?timeStamp=" + new Date().getTime();
	xmlhttp.open("post", url, true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=gb2312');
	xmlhttp.send("lj_id="+escape(lj_id)+"&Col_id="+escape(Col_id)+"&pro_id="+escape(pro_id));	
}
function allsid_result(data){
	
	var pronames
	var data_arr
	if(data!="0"){
		data = data.split('%%');
			$("select")[3].options.length=0;
			for(data_i=0;data_i<data.length;data_i++){
				data_arr=data[data_i];
				data_arr=data_arr.split('||');
				$("select")[3].options[data_i] = new Option(data_arr[1],data_arr[0]);
				}
			$("select")[3].selectedIndex = data_i;
			addOption(0,$("select")[3]);
			setSel("请选择...",$("select")[3])
		$("span")[1].innerHTML="<img src='../images/reg_yesok.gif' alt='班级下拉列表更新成功!'>";
		checkcla();
	}else{
		fillSel("当前还没有班级",$("select")[3]);
		$("span")[1].innerHTML="<img src='../images/reg_yesno.gif' alt='班级下拉列表为空,请添加专业!'>";
	}
}

function CheckForm_adds() {
	var strclaid = $("select")[3].options[$("select")[3].selectedIndex].value*1;
	var founderr=true;
	if (strclaid==0){
		$("span")[1].innerHTML="<img src='../images/reg_yesno.gif' alt='请选择学校所在集体!'> 请选择学校所在集体!";
		founderr=false;
	}else{
		for (i=0;i<$inp("name").length ;i++ ){
			if ($inp("name")[i].value==""){
				$inp("name")[i].style.border="1px solid #FF1010";
				founderr= false;
			}else{$inp("name")[i].style.border="1px solid #ccc";}
			if ($inp("stuid")[i].value==""){
				$inp("stuid")[i].style.border="1px solid #FF1010";
				founderr= false;
			}else{$inp("stuid")[i].style.border="1px solid #ccc";}
		}
	}
	if (founderr==true){
		for (i=0;i<$inp("IdentityNO").length ;i++ ){
			if ($inp("IdentityNO")[i].value==""){
				$inp("IdentityNO")[i].value=" "
			}
		}
		for (i=0;i<$inp("con").length ;i++ ){
			if ($inp("con")[i].value==""){
				$inp("con")[i].value=" "
			}
		}
		return true;
	}else {
		return false;
	}	
}