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

先举一个c#的例子

验证用户表单输入

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

1@ Page Language="C#" 
 1<html>
 2<script language="javascript">   
 3function ClientValidateEmail(source, value)   
 4{   
 5var strr;   
 6re=/(\w+@\w+\\.\w+)(\\.{0,1}\w*)(\\.{0,1}\w*)/i;   
 7re.exec(value);   
 8if (RegExp.$3!=""&&RegExp.$3!="."&&RegExp.$2!=".") strr=RegExp.$1+RegExp.$2+RegExp.$3   
 9else   
10if (RegExp.$2!=""&&RegExp.$2!=".") strr=RegExp.$1+RegExp.$2   
11else strr=RegExp.$1   
12if (strr!=value)   
13return false;   
14else   
15return true;   
16}   
17</script>
18<body>
19<h3>ASP.NET验证用户输入</h3>
20<form method="post" runat="server">
21<hr noshade="" size="1" width="600"/>
22<table>
23<tr>
24<td>
25<asp:validationsummary displaymode="bulletlist" font-name="宋体" font-size="12" headertext="你必须输入下面这些表单域:" id="valSum" runat="server"></asp:validationsummary>
26</td>
27</tr>
28</table>
29<center>
30<p></p></center></form></body></html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus