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

📄 gyomukanri.js

📁 基于Struts的试卷分析系统
💻 JS
字号:

function submitFormWithActionName(docform,actionName){								
	docform.action = actionName;	 							
	docform.submit();
}


function formWithActionName(docform,actionName){								
	docform.action = actionName;	
}


function buttonSubmit(frm){
	if(frm.isSent.value=="1"){
	alert("偡偱偵憲怣偝傟偰偄傑偡丅憲怣張棟偑姰椆偡傞傑偱偟偽傜偔偍懸偪偔偩偝偄丅");
		return false;
	} else {
		frm.isSent.value="1";	
		return true;
	}						
}



function openRepWin(url, name) {
	param = 'width=800, height=600,left=112,top=69,depended=yes,z-look=yes,toolbar=no, menubar=no,resizable=yes, scrollbars=no, location=no, status=no';
	window.open(url, name, param);
}

function openPopWin(url, name) {
	param = 'width=800, height=600,left=112,top=69,depended=yes,z-look=yes,toolbar=no, menubar=no,resizable=yes, scrollbars=yes, location=no, status=no';
	window.open(url, name, param);
}

function isCheckedCheckbox(targetForm, strCheckboxName) {
    return targetForm.elements[strCheckboxName].checked;
}	

function isValidDate(day, month, year) {	  
	year  = parseInt(year, 10);
	month = parseInt(month,10);
	day   = parseInt(day,  10);	
	if (year == 0) {
		return false;
	}	  	
	if (month < 1 || month > 12) {
		return false;
	}
	if (day < 1 || day > 31) {
		return false;
	}
	if ((month == 4 || month == 6 || month == 9 || month == 11) &&
		(day == 31)) {
		return false;
	}
	if (month == 2) {
		var leap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day>29 || (day == 29 && !leap)) {
			return false;
		}
	}	  
	return true;
}

function doTransDate(property,strMessage) {

	var strDate = property.value;
		
	if (strDate != ""){			
		if (strDate.length != 10) {		
			if (strDate.length == 8) {
		    	/*  translate 'YYYYMMDD' to  'YYYY/MM/DD'  */
			    for(j=0; j<strDate.length; j++) {
					if ((strDate.charAt(j) < '0' || strDate.charAt(j) > '9')) {
						alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');	
						property.focus();	
						return;			
					}
				}
			    var yearStr  = strDate.substring(0,4);
			    var monthStr = strDate.substring(4,6);
			    var dayStr   = strDate.substring(6,8);

				if (isValidDate(dayStr, monthStr, yearStr) == true)  {						
					var strTransDate = yearStr + '/' + monthStr + '/' + dayStr;
		            property.value = strTransDate;
					return;	
				}
				else {
					 alert('擔晅偺斖埻巜掕偑晄惓偱偡丅惓偟偄斖埻傪擖椡偟偰偔偩偝偄丅');
			    	 property.focus();	
			    	 return;
				}	
						
		    } else {
		    	 alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
		    	 property.focus();	
		    	 return;
			}	
		} else {		
			/*  YYYY/MM/DD  */					
			var yearStr  = strDate.substring(0,4);
			var monthStr = strDate.substring(5,7);
			var dayStr   = strDate.substring(8,10);
			
			var strEsToken1 = strDate.substring(4,5);
			var strEsToken2 = strDate.substring(7,8);
		    
			if (strEsToken1 != '/' || strEsToken2 != '/') {
		        alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
		        property.focus();	
		        return;
			 } else {
			 		var count = 0;
					for(j=0; j<strDate.length; j++) {
						if(strDate.charAt(j) != '/'	&& count < 3) {
							if ((strDate.charAt(j) < '0' || strDate.charAt(j) > '9')) {
								alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
								property.focus();	
								return;			
							}
						} else {
							j++;
							count++;
						}
						if (count > 2) {
							alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
							property.focus();	
							return;		
						}
							
					}					 
					if (isValidDate(dayStr, monthStr, yearStr) == true)  {
						var strTransDate = yearStr + '/' + monthStr + '/' + dayStr;
			            property.value = strTransDate;
						return;
					
					} else {
						 alert('擔晅偺斖埻巜掕偑晄惓偱偡丅惓偟偄斖埻傪擖椡偟偰偔偩偝偄丅');
					     property.focus();	
					   	 return;
					}	
						
			 }
		 }
	} 			
}

function doTransYM(property,strMessage) {

	var strDate = property.value;
		
	if (strDate != ""){			
		if (strDate.length != 7) {		
			if (strDate.length == 6) {
		    	/*  translate 'YYYYMMDD' to  'YYYY/MM/DD'  */
			    for(j=0; j<strDate.length; j++) {
					if ((strDate.charAt(j) < '0' || strDate.charAt(j) > '9')) {
						alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');	
						property.focus();	
						return;			
					}
				}
			    var yearStr  = strDate.substring(0,4);
			    var monthStr = strDate.substring(4,6);

				if (isValidDate("12",monthStr, yearStr) == true)  {						
					var strTransDate = yearStr + '/' + monthStr;
		            property.value = strTransDate;
					return;	
				}
				else {
					 alert('擔晅偺斖埻巜掕偑晄惓偱偡丅惓偟偄斖埻傪擖椡偟偰偔偩偝偄丅');
			    	 property.focus();	
			    	 return;
				}	
						
		    } else {
		    	 alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
		    	 property.focus();	
		    	 return;
			}	
		} else {		
			/*  YYYY/MM/DD  */					
			var yearStr  = strDate.substring(0,4);
			var monthStr = strDate.substring(5,7);
			
			var strEsToken1 = strDate.substring(4,5);
		    
			if (strEsToken1 != '/') {
		        alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
		        property.focus();	
		        return;
			 } else {
			 		var count = 0;
					for(j=0; j<strDate.length; j++) {
						if(strDate.charAt(j) != '/'	&& count < 3) {
							if ((strDate.charAt(j) < '0' || strDate.charAt(j) > '9')) {
								alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
								property.focus();	
								return;			
							}
						} else {
							j++;
							count++;
						}
						if (count > 2) {
							alert(strMessage+'偼惓偟偄擔晅偱偼偁傝傑偣傫');
							property.focus();	
							return;		
						}
							
					}					 
					if (isValidDate("12",monthStr, yearStr) == true)  {
						var strTransDate = yearStr + '/' + monthStr;
			            property.value = strTransDate;
						return;
					
					} else {
						 alert('擔晅偺斖埻巜掕偑晄惓偱偡丅惓偟偄斖埻傪擖椡偟偰偔偩偝偄丅');
					     property.focus();	
					   	 return;
					}							
			 }
		 }
	} 			
}

Math.getNumeric = function (vValue) {
	var vReturn = String(vValue);
	vReturn = vReturn.replace(/,/gi, "");  // 僇儞儅彍嫀
	vReturn = vReturn.replace(/\s/gi, ""); // 敿妏僗儁乕僗彍嫀
	vReturn = vReturn.replace(/丂/gi, ""); // 慡妏僗儁乕僗彍嫀	

	// 敾掕
	// [^0-9\.\-]  悢抣(0乣9, ".")埲奜偺暥帤楍
	if(vReturn != null && !isNaN(vReturn) && !vReturn.match(/[^0-9\.]/g)) {
		// ^\..*       "."奐巒偺暥帤楍
		// ^0[0-9]+    "0"奐巒 偵 (0-9) 傪偮側偘偨暥帤楍
		// .$          "."廔椆偺暥帤楍
		// 抣偑 "" 偺応崌丄摿庩張棟傪捠偝偢偵 "" 傪曉偡
		if(vReturn == "") return "";		
		if(Number(vReturn) == 0) return 0;
		if(Number(vReturn) < 0) {
			return;
		}
		// 0(0-9)ゥ

⌨️ 快捷键说明

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