【原创】对“学号”、“身份证”的数字分析(2)

王朝asp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

摘要:

对身份证号码的分析同对学号的分析类似。

正文:

这里认为身份证号是18位的。

在页面上添加一个Label控件,一个TextBox控件,一个Button控件,一个Literal控件。Label控件的Text属性设为“身份证号:”,Literal控件将显示身份证号里的信息。关键还是在Button控件的Click()事件中。

Button控件的Click()事件:

string strID = txtID.Text;

if (!txtID.Visible)

{

txtID.Visible = true;

}

try

{

string strYear = strID.Substring(6,4); // 年

string strMonth = strID.Substring(10,2); // 月

string strDay = strID.Substring(12,2); // 日

Literal1.Text = "您的生日是:"+strYear+"年"+strMonth+"月"+strDay+"号";

}

catch

{

Response.Write("程序有错误!");

}

finally

{

}

显示效果图:

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航