亚里士多德
鱼对水说你看不到我的眼泪,因为我在水里.水说我能感觉到你的眼泪,因为你在我心里.
<%@ Language=VBScript %>
<script language="javascript" runat="server"> 
function isNumeric(strNumber) { 
return (strNumber.search(/^(-|\+)?\d+(\.\d+)?$/!= -1); 

function isUnsignedNumeric(strNumber) { 
return (strNumber.search(/^\d+(\.\d+)?$/!= -1); 

function isInteger(strInteger) { 
return (strInteger.search(/^(-|\+)?\d+$/!= -1); 

function isUnsignedInteger(strInteger) { 
return (strInteger.search(/^\d+$/!= -1); 

</script> 

function isDateShort(strDate)
{
return FormatValue(strDate);
}


<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Function FormatValue(Value)
 FormatValue 
= isDate(Value)
End Function
</SCRIPT>
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Function FormatValue(Value)
    isS 
= isDate(Value)
    
dim    nowDates
    
if isS=true then
        nowDates 
= Value
    
else
        nowDates 
= left(Value,4& "-" & mid(Value,5,2& "-" & right(Value,2)
    
end if
    
if isDate(nowDates)=true then
        FormatValue 
= Value
    
else
        FormatValue 
= ""
    end if
End Function
</SCRIPT>

<HTML>
<BODY>
<b>判断数字的正确性</b>
<%
Dim strTemp
strTemp = CStr(Request.Form("inputstring"))
If strTemp = "" Then strTemp = "0"
%>
<TABLE BORDER="1" CELLPADDING="4" CELLSPACING="2">
<TR>
<TD ALIGN="right"><B>原始字符串</B></TD>
<TD><%= strTemp %></TD>
</TR>
<TR>
<TD ALIGN="right"><B>数字</B></TD>
<TD><%=isNumeric(strTemp)%></TD>
</TR>
<TR>
<TD ALIGN="right"><B>非负数字</B></TD>
<TD><%=isUnsignedNumeric(strTemp)%></TD>
</TR>
<TR>
<TD ALIGN="right"><B>整数</B></TD>
<TD><%=isInteger(strTemp)%></TD>
</TR>
<TR>
<TD ALIGN="right"><B>非负整数()</B></TD>
<TD><%=isUnsignedInteger(strTemp)%></TD>
</TR>
</TABLE>
<FORM ACTION="<%=Request.ServerVariables("SCRIPT_NAME")%>" METHOD="post">
请输入一个数字:<BR>
<INPUT TYPE="text" NAME="inputstring" SIZE="50"></INPUT><BR>
<INPUT TYPE="submit" Value="提交"></INPUT><BR>
</FORM>
</BODY>
</HTML>
posted on 2005-04-21 16:10  Austin leng  阅读(565)  评论(0编辑  收藏  举报