ASP.NET升级能力探讨(二)

  • 来源: 互联网 作者: rocket   2008-03-24/14:09
  • 先举一个c#的例子

    验证用户表单输入

    运行环境:Win2000 Advance Server+IIS5.0+NGWS SDK(80M的).

    <%@ Page Language="C#" %>

    <html>
    <script language="javascript">
    function ClientValidateEmail(source, value)
    {
    var strr;
    re=/(\w+@\w+\.\w+)(\.{0,1}\w*)(\.{0,1}\w*)/i;
    re.exec(value);
    if (RegExp.$3!=""&&RegExp.$3!="."&&RegExp.$2!=".") strr=RegExp.$1+RegExp.$2+RegExp.$3
    else
    if (RegExp.$2!=""&&RegExp.$2!=".") strr=RegExp.$1+RegExp.$2
    else strr=RegExp.$1
    if (strr!=value)
    return false;
    else
    return true;
    }
    </script>
    <body>

    <h3>ASP.NET验证用户输入</h3>

    <form method=post runat=server>
    <hr width=600 size=1 noshade>
    <table>
    <tr>
    <td>
    <asp:ValidationSummary ID="valSum" runat="server"
    HeaderText="你必须输入下面这些表单域:"
    DisplayMode="bulletlist"
    Font-Name="宋体"
    Font-Size="12"
    />
    </td>
    </tr>
    </table>
    <center>
    <p>


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多