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

📄 foronline.js

📁 最全的介绍C语言结构体的使用方法和使用技巧!
💻 JS
📖 第 1 页 / 共 3 页
字号:
	parentNode.removeChild(node);
}

function addChild(doc,parentNode)
{
	for (var i=2;i<addChild.arguments.length ;i++ )
	{
		var obj=document.all(arguments[i]);
		if (obj.tagName=="INPUT")
		{
			addEle(doc,parentNode,arguments[i],obj.value);
		}
		else if (obj.tagName=="SELECT"&&obj.selectedIndex!=-1)
		{
			addEle(doc,parentNode,arguments[i],obj.value,obj.options[obj.selectedIndex].text);
		}
	}
}

function getChildByNV(parentNode,childName,rule,value)
{
	return parentNode.selectNodes(childName+"["+rule+"='"+value+"']");
}

function delChildByCheck(parentNode,childName,rule,check)
{
	var arr=getCheckedValue(check);
	for (var i=0;i<arr.length ;i++ )
	{
		var nodeList=getChildByNV(parentNode,childName,rule,arr[i]);
		for (var j=0;j<nodeList.length ;j++ )
		{
			delEle(parentNode,nodeList[j]);
		}
	}
}

function repXML()
{
	for (var i=0;i<repXML.arguments.length ;i+=2 )
	{
		var list=repXML.arguments[i];
		var nodeList=repXML.arguments[i+1];
		for (var j=0;j<list.length ;j++ )
		{
			node=nodeList.selectSingleNode(".//*[Id='"+list[j].text+"']/Descrip");
			if (node!=null&&node.text!=null)
			{
				list[j].setAttribute("Descrip",node.text);
			}
			else
			{
				list[j].setAttribute("Descrip","无");
			}
		}
	}
}

//根据节点列表设置表单元素的值
function setForm(nodeList,doc,pre,be)
{
	//alert(nodeList.length);
	for (var i=0;i<nodeList.length ;i++ )
	{
		var name=nodeList[i].nodeName;
		var name_=name;
		if (pre!=null){name_=pre+name_;}
		if (be!=null){name_=name_+be;}
		var value=nodeList[i].text;
		var obj=doc.all(name_);
		//alert(obj==null?"":obj.tagName+":"+name_+":"+value);
		if (name!=null&&obj!=null&&value!=null)
		{
			//alert(obj.tagName+":"+name_+":"+value);
			if ((obj.tagName=="INPUT"&&(obj.type=="text")||obj.type=="hidden")||obj.tagName=="TEXTAREA")
			{
				obj.value=value;
			}
			else if (obj.tagName=="SELECT")
			{
				setList(obj,value);
			}
			else if (obj.tagName=="INPUT"&&obj.type=="radio")
			{
				setRadio(obj,value);
			}
			else if (obj.tagName=="INPUT"&&obj.type=="checkbox")
			{
				setCheckBox(obj,value);
			}
			else if (obj.tagName=="A")
			{
				obj.innerHTML=value;
			}
		}
		if (name!=null&&obj!=null&&value!=null&&obj.length>0)
		{
			if (obj[0].tagName=="INPUT"&&obj[0].type=="radio")
			{
				setRadio(obj,value);
			}
			else if (obj[0].tagName=="INPUT"&&obj[0].type=="checkbox")
			{
				setCheckBox(obj,value);
			}
		}
	}
}

//

function repForm()
{
	for (var i=0;i<repForm.arguments.length ;i+=2 )
	{
		var obj=document.all(repForm.arguments[i]);
		var node=repForm.arguments[i+1];
		if (obj.tagName=="A")
		{
			obj.innerHTML=getTabVal(node,obj.innerHTML);
		}
		else if (obj.tagName=="INPUT")
		{
			obj.value=getTabVal(node,obj.value);
		}
	}
}
//从值表中取对应值。
function getTabVal(node,id)
{
	var node_=node.selectSingleNode(".//*[Id='"+id+"']/Descrip");
	if (node_!=null&&node_.text!=null)
	{
		return node_.text;
	}
	else
	{
		return id;
	}
}

function showHTML(doc_i,doc,xsl)
{
	doc_i.close();
	doc_i.open();
	doc_i.write(doc.transformNode(xsl));
}

/* fn-hd ********************************************************************** 
 * fun: 转换费用项目的描述 
 * par: 
 * ret: 
 * rem: 
 * exm: 
 * sep: 
 * pub: 
 * log: 
 * aut:panwj(潘文金) 
 * 2002年05月20日 16时49分58秒 建立.[SpL9DPU3x9xDo] */ 

function writePurZh(p_index,p_strNo,p_strValStr) 

/*fn-tl **********************************************************************/ 
{ 
      p_strNo = getValDesc(p_strNo,p_strValStr); 
      var m_strShow = "<INPUT TYPE='TEXT' size='5' ReadOnly='true' NAME='PurchaseName"+trim(p_index)+"' value="+p_strNo+"  style='border-style: solid; border-color:#FFFFFF;'/>";       
      document.write(m_strShow); 
} 


function parseNumber(decimals)
{
if (decimals!="")
{
var decimals1 = (decimals).split(".");
var decimals2 = (decimals).split(".")[1];
if (decimals1.length > 0)
{
	if (decimals2 != null)
	{
		//if (parseInt(decimals1))
		if (decimals2.length == 1)
		{
			decimals2+="0";
		}
		if (decimals2.length == 0)
		{
			decimals2+="00";
		}
		if (decimals2.length > 2)
		{
			decimals2=decimals2.substring(0,2);
		}
		

	}
	else
	{
		decimals2 = "00";
	}

}
else
{
	decimals2 = "00";
}
}
else
{
	return ("0.00");
}
var decimals3 =(""+decimals).split(".")[0] +"." +decimals2;
return decimals3;
}

/* fn-hd ********************************************************************** 
 * fun: 约束客户号和手机号共有输入框的方法
 * par: 
 * ret: 
 * rem: 
 * exm: 
 * sep: 
 * pub: 
 * log: 
 * aut:litao(李涛) 
 * 2002年08月22日 19时09分58秒 建立.[SpL9DPU3x9xDo] */ 

function isCustNo(str)
{
	if (getAscLen(trim(str)) != 8 && getAscLen(trim(str)) != 11)
	{
		return false;
	}
	if (getAscLen(trim(str)) == 11)
	{
		if (!isNumber(trim(str),11,11))
		{
			return false;
		}
	}
	return true;
}

function isCustCode(str)
{
	return getAscLen(trim(str)) == 8;
}
/* fn-hd ********************************************************************** 
 * fun: 约束时分秒输入框的方法
 * par: 
 * ret: 
 * rem: 
 * exm: 
 * sep: 
 * pub: 
 * log: 
 * aut:litao(李涛) 
 * 2002年08月25日 19时09分58秒 建立.[SpL9DPU3x9xDo] */ 

function isTimeStr(vTime)
{
	if(vTime==null||trim(vTime)=="")return false;
	vTime=trim(vTime);
	if(getAscLen(vTime)!=6)return false;
	//非数字判断
	var vStrHour=vTime.substring(0,2);
	var vStrMinute=vTime.substring(2,4);
	var vStrSecond=vTime.substring(4,6);
	for(var i=0;i<=1;i++)if(!checkBit(vTime.substring(i,i+1)))return false;
	for(var i=2;i<=3;i++)if(!checkBit(vTime.substring(i,i+1)))return false;
	for(var i=4;i<=5;i++)if(!checkBit(vTime.substring(i,i+1)))return false;	
	//
	var vJudgeStr=vTime.substring(0,1);
	if(parseInt(vJudgeStr,10)>2)return false;
	vJudgeStr=vTime.substring(1,2);
	if (parseInt(vTime.substring(0,1),10)==2)
	{
		if(parseInt(vJudgeStr,10)>4)return false;
	}
	vJudgeStr=vTime.substring(2,3);
	if(parseInt(vJudgeStr,10)>6)return false;
	vJudgeStr=vTime.substring(4,5);
	if(parseInt(vJudgeStr,10)>6)return false;

	var vInt1=parseInt(vTime.substring(0,2),10);
	var vInt2=parseInt(vTime.substring(2,4),10);
	var vInt3=parseInt(vTime.substring(4,6),10);
	if( vInt1 > 24 || vInt2 > 60 || vInt3 > 60)
		return false;
	return true;



}
/**
*检查一位是不是数字
*@param aBit 一位数字
*@param true(数字),false(非数字)
*/
function checkBit(aBit)
{
	
	aBit=trim(aBit);
	if(aBit=="")return false;
	var aInteger =parseInt(aBit,10);
	var aNewString=aInteger.toString();
	if(aBit!=aNewString)
	{
		return false;
	}
	return true;
}

/* fn-hd ********************************************************************** 
 * fun: 约束当前页面所有Input和textArea输入框内容的方法
 * par: 
 * ret: 
 * rem: 
 * exm: 
 * sep: 
 * pub: 
 * log: 
 * aut:litao(李涛) 
 * 2002年08月22日 19时09分58秒 建立.[SpL9DPU3x9xDo] */ 

function checkAllInput(doc)
{
	
	
	var tags=doc.getElementsByTagName('*');
	for (var i=0;i<tags.length ;i++ )
	{
		if (tags[i].tagName=="INPUT"||tags[i].tagName=="TEXTAREA"||tags[i].tagName=="PASSWORD")
		{
			/**
			*替换特殊字符
			*/
			fomatTextarea_1(tags[i]);
			fomatALLText(tags[i]);
		
			var o=tags[i];
			
		
			var v=tags[i].value;

			if (o.maxLength==2147483647||o.getAttribute('des')==null||o.maxLength==null||o.getAttribute('isCheck')=="IGNORE")
			{
				//alert(o.name+"缺少maxLength和des两属性,方法将不对它进行检查!");
				continue;
			}
			
			if (o.maxLength!=2147483647&&o.getAttribute('des')!=null&&o.maxLength!=null)
			{
				
				if (o.getAttribute('isNeed') == "1"&&trim(v) == "")
				{						
					if (o.exec!=null){eval(o.exec);}
					alert("对不起,"+o.getAttribute('des')+"必须填写!");
					doc.o.focus();
					return false;
				}
				if ((o.getAttribute('desType')!="SPECIAL") && trim(v) != "")//校验输入是否有特殊字符
				{
						if(findSpecilize(v))
						{
							alert("对不起!"+o.getAttribute('des')+"不能包含(`#|&\'\"%)字符!");
							doc.o.focus();
							return false;
						}
				}
				if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "ACCT"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对字母、数字、-、_的检查
				{
					if (trim(v) != ""&&(!isValidStr(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为只包含字母、数字、_、-的字符串!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "DEVNO"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对手机输入框的检查
				{
					if (trim(v) != ""&&(!isNumber(trim(v),11,11)))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"长度或类型不正确,正确应为"+o.maxLength+"位数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "DATE"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对日期输入框的检查
				{
					if (trim(v) != ""&&trim(v).substring(4,5)=="年"){
						if (!isDate_cn(trim(v)))
						{
							if (o.exec!=null){eval(o.exec);}
							//alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确,正确格式应为YYYY年MM月DD日!");
							alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确!");
							doc.o.focus();
							return false;
						}
					}else{				
						if (trim(v) != ""&&(!isDate(trim(v),"-")))
						{
							if (o.exec!=null){eval(o.exec);}						
							//alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确,正确应为10位日期格式YYYY-MM-DD!");
							alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确!");
							doc.o.focus();
							return false;
						}
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "CUSTNO"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对客户编号输入框的检查
				{
					if (trim(v) != ""&&(!isNumber(trim(v),8,8)))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"长度或类型不正确,正确应为"+o.maxLength+"位数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "POSTCODE"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对邮编输入框的检查
				{
					if (trim(v) != ""&&(!isNumber(trim(v),6,6)))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"长度或类型不正确,正确应为6位数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "CUSTDEV"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对客户编号或手机号输入框的检查
				{
					if (trim(v) != ""&&(!isCustNo(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("输入的号码长度有误,正确应为8位或11位数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "TIME"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对时间输入框的检查
				{
					if (trim(v) != ""&&(!isTimeStr(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确,正确应为6位时间格式HHMMSS!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "EMAIL"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对EMail输入框的检查
				{
					if (trim(v) != ""&&(!isMail(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"格式不正确,正确应类似于forlink@softhouse.com.cn格式!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "NUMBER"&&o.getAttribute('des')!=null&&o.maxLength!=null)//对自然数输入框的检查
				{
					if (trim(v) != ""&&(!isNumber(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为0到9之间的数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "SHORT") //对Short类型输入框的检查
				{
					if (trim(v) != ""&&(!isShort(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为大小介于0~65535之间的数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "LONG") //对Long类型输入框的检查
				{
					if (trim(v) != ""&&(!isLong(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为大小介于0~4294967296之间的数字!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "FLOAT") //对Float类型输入框的检查
				{
					if (trim(v) != ""&&(!isDouble(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为实数!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "PLUS")//对正数输入框的检查
				{
					if (trim(v) != ""&&(!isPlus(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为0到9之间的数字且值必须大于0!");
						doc.o.focus();
						return false;
					}
				}
				else if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "CERTIFICATE")
				{
					if (trim(v) != ""&&(!isCertificate(trim(v))))
					{
						if (o.exec!=null){eval(o.exec);}
						alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为15或18位数字!");
						doc.o.focus();
						return false;
					}
				}
				if (o.max!=null&&o.max!=""&&o.getAttribute('desType')!=null&&v!=null&&v!=""&&compareTo(trim(v),o.max,o.getAttribute('desType'))==1)
				{
					if (o.exec!=null){eval(o.exec);}
					doc.o.focus();
					alert("对不起,您输入的"+o.getAttribute('des')+"必须不大于"+o.max);
					return false;
				}
				if (o.min!=null&&o.min!=""&&o.getAttribute('desType')!=null&&v!=null&&v!=""&&compareTo(trim(v),o.min,o.getAttribute('desType'))==-1)
				{
					if (o.exec!=null){eval(o.exec);}
					doc.o.focus();
					alert("对不起,您输入的"+o.getAttribute('des')+"必须不小于"+o.min);
					return false;
				}
				if (getAscLen(v)>o.maxLength)
				{
					if (o.exec!=null){eval(o.exec);}
					alert(o.getAttribute('des')+"输入长度不得超过"+o.maxLength+"个字符!");
					doc.o.focus();
					return false;
				}
				if (o.minLength!=null&&o.minLength!="")
				{
					if (getAscLen(v)<o.minLength)
					{
						if (o.exec!=null){eval(o.exec);}
						alert(o.getAttribute('des')+"输入长度不得小于"+o.minLength+"个字符!");
						doc.o.focus();
						return false;
					}
				}
				if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "MONEY")
				{
					if (trim(v) != ""&&(!isMoney(trim(v))))
					{
						if (o.exec!=null)							{eval(o.exec);}
							alert("对不起,您输入的"+o.getAttribute('des')+"不正确,应为最多两位小数的数字!");
						doc.o.focus();
						return false;
					}
					if (o.limit!=null&&o.unit!=null)
					{
						if (!checkMoneyLimit(trim(v),o.limit,o.unit)){
							alert("对不起,您输入的"+o.getAttribute('des')+"整数部分不能超过"+(o.limit-o.unit)+"位");
							doc.o.focus();
							return false;
						}
					}
				}		
				if (o.getAttribute('desType')!=null&&trim(o.getAttribute('desType')) == "MONEY4")
				{
					if (trim(v) != ""&&(!isMoney4(trim(v))))
					{
						if (o.exec!=null)							{eval(o.exec);}
							alert("对不起,您输入的"+o.getAttribute('des')+"类型不正确,正确应为数字或小数点!");
						doc.o.focus();
						return false;
					}
					if (o.limit!=null&&o.unit!=null)
					{
						if (!checkMoneyLimit(trim(v),o.limit,o.unit)){
							alert("对不起,您输入的"+o.getAttribute('des')+"整数部分不能超过"+(o.limit-o.unit)+"位");
							doc.o.focus();

⌨️ 快捷键说明

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