在客户端JAVASCRITP处理TEXTFORM的函数
2008-01-05 09:39:34 来源:WEB开发网核心提示:<Html><HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"><TITLE></TITLE></HEAD><BODY&
<Html>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM action="" method=post id=form1 name=form1 onsubmit="return CheckForm()">
<P><INPUT id=text1 name=text1><INPUT id=submit1 name=submit1 type=submit value=Submit></P></FORM>
<P> </P>
<P> </P>
<P> </P>
<SCRipT LANGUAGE=javascript>
<!--
function KillSpace(x){
while((x.length>0) && (x.charAt(0)==' '))
x = x.substring(1,x.length);
while((x.length>0) && (x.charAt(x.length-1)==' '))
x = x.substring(0,x.length-1);
return x;
}
function CheckText(Obj,TypeValue,Msg,Necessary)
{
/*TypeValue
'd': Numeric;
'i': All Integer
'r': Aeal Number
'f': Decimal Fraction
'l': 26 letter
'ul':[A-Z]
'll':[a-z]
'w': [a-zA-Z_0-9]
'S': Chinese Characters and Special Characters
Obj Required.
Msg Return PRompt Message
Necessary is Optional Parameter
*/
if (isNaN(Necessary))
Necessary=false;
Obj.value=KillSpace(Obj.value);
switch (TypeValue)
{
case "d":
res=new RegEXP("^[0-9]+$","g");
break;
case "i":
res=new RegExp("(^[1-9][0-9]*$)(^[\+\-][1-9][0-9]*$)","g");
Tags:客户端 JAVASCRITP 处理
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接