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

📄 feedbacktable.js

📁 这是一个用java三层框架做的ISS学员管理系统
💻 JS
字号:
	
		//添加行
		function instRow(){
			var table1 = window.document.getElementById('table1');
			if(table1.rows.length>=7){
				alert('人数已经到最大限制,不能继续添加!');
				return;
			}
			var row = table1.insertRow(table1.rows.length-1);
			var cell1 = row.insertCell(0);
			var cell2 = row.insertCell(1);
			var cell3 = row.insertCell(2);
			var cell4 = row.insertCell(3);
			cell1.align="center";
			cell4.align="center";
			cell1.innerHTML=table1.rows.length-2;
			cell2.innerHTML="<td><input class='char' type='text'  name='feedbackTeacher' style='width:170' onclick='openVirtualWindow(this);' readonly/>&nbsp;<font color='red'>*</font></td>";
			cell3.innerHTML="<td><select name='feedbackContext' class='select' style='width:170'><option value='0' selected>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----请选择----</option><option value='1'>JAVA初级</option><option value='2'>JAVA高级</option><option value='3'>Oracle初级</option><option value='4'>Oracle高级</option><option value='5'>实战</option></select>&nbsp;<font color='red'>*</font></td>";
			cell4.innerHTML="<td><a href='javascript:void(0)' onClick='delRow(this);'>删除</a></td>";
		
		}
		//刷新序号
		function  refreshIndex(){
			var table1 = window.document.getElementById('table1');
			for(var i = 1 ; i<table1.rows.length-1 ;i++){
				table1.rows[i].cells[0].innerText=i;
			}
		}	
		//删除行	
		function delRow(delrow){
			 var table1 = window.document.getElementById('table1');
			 var index1=delrow.parentElement.parentElement.rowIndex;
			 table1.deleteRow(index1);
			 refreshIndex();
		}
		
		//输入验证
		function checkInput(){
			
			if(document.form1.feedBackClass.value.length==0){
				alert('班级不能为空!');
				return;
			}
			if(document.form1.feedBackLastDate.value.length==0){
				alert('截止日期不能为空!');
				return ;
			}
			
    		var date1 = window.document.form1.feedBackLastDate.value;
    		var table2 = window.document.getElementById('table2');
    		var date2 = table2.rows[2].cells[1].innerText;
    		if(date2>date1){
    			alert('有效期输入错误!');
    			return;
    		}
   
			var table1 = window.document.getElementById('table1');
			var lengths = table1.rows.length;
			if(lengths<3){
				alert('反馈表中必须存在老师和反馈内容!');
				return ;
			}
			if((checkEmptys("feedbackTeacher","反馈人必须填写!"))){
				return;
			}
			if(checkInputsZero("feedbackContext","必须选择一项反馈内容!")){
				return;
			}
			if(confirm("确定提交吗?")){
				alert('提交成功!');
			}
			
		}
		//弹出虚拟窗口,选择被反馈人
		function openVirtualWindow(rowNum1){
			var rowNumber = rowNum1.parentElement.parentElement.rowIndex;
			window.document.form1.rowNum.value=rowNumber;
  			var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=no, "
                + "location=no, status=no, titlebar=no, width=600, "
                + "height=280, top=200, left=200";  
  			window.open("feedBackLaunchAction.do?method=feedBackTeacherList", 'main1', sFeatures); 
   		}
   		//将虚拟窗口中被选中的老师的名字写回到父窗口中
   		//属于虚拟窗口中的函数
   		function getTeacher(teacherName){
 			var x = window.opener.document.form1.rowNum.value;
 			var table1 = window.opener.document.getElementById('table1');
 			table1.rows[x].cells[1].children[0].value=teacherName;
		}
		//关闭虚拟窗口
		function closeWindow(){
			window.close();
		}
		
		//当用户点击取消是,将所有的输入框内容清空,并且删除所有已经添加的行,回到初始状态
		function cancelAll(){
    		window.document.form1.feedBackClass.value="";
    		window.document.form1.feedBackLastDate.value="";
    		var table1 = window.document.getElementById('table1');
    		var len = table1.rows.length;
    		while(len>2){
    			table1.deleteRow(len-2);
    			len = len-1;
    		}
    	}
    	//取出当前日期
    	function init(){
    		var d = new Date();
    		var str = d.getYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
    		var table2 = window.document.getElementById("table2");
    		table2.rows[2].cells[1].innerText=str;
    	}
    	
    	//弹出班级列表窗口
    	function ClassWindow(){
  			var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=no, "
                + "location=no, status=no, titlebar=no, width=600, "
                + "height=280, top=200, left=200";  
            window.open('feedBackLaunchAction.do?method=feedBackClassesList','main1', sFeatures);
   		}
   		
   		//将选中的班级写回到父窗口的班级输入框中
   		function getClass(className){
 			 window.opener.document.form1.feedBackClass.value=className;
		}

⌨️ 快捷键说明

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