asp.net¿Í»§¶Ë»ò·þÎñ¶ËÑéÖ¤·½Ê½
¿Í»§¶ËÑéÖ¤·½Ê½£º
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Button1.Attributes.Add("onclick", "return checkSame()");//ΪButton1Ìí¼Óonclick()ʼþ ,ButtonΪ·þÎñÆ÷¿Ø¼þ
}
}
<script type="text/javascript">
function trim(s) {
return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}
function checkSame(){
var ob1=trim(document.getElementById('username').value);
var patrn=/^[A-Za-z0-9_-]+$/;
if(ob1.length==0) {
alert('wrong');
return false; }
if (!patrn.exec(ob1)) {alert("bu pi pei"); return false ; }
return true;
}
</script>
·þÎñ¶ËÑéÖ¤·½Ê½£ºusing System.Text.RegularExpressions;
protected void Button1_Click(object sender, EventArgs e)
{ string username=this.username.Text;
string pass = this.password.Text;
if (username.Trim().Length == 0 || username == "") { RegisterStartupScript("", "<script language=javascript>alert('Óû§Ãû²»ÄÜΪ¿Õ£¡');</script>"); }
&n
Ïà¹ØÎĵµ£º
ÔÚwindows 2003ÏÂ,ÔÚÔËÐÐwebÓ¦ÓóÌÐòµÄʱºò³öÏÖһϴíÎó:
·þÎñÆ÷ÎÞ·¨´¦ÀíÇëÇ󣬣££¾¶Ô·¾¶“C:\temp\mytest.txt”µÄ·ÃÎʾܾø
˵Ã÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£
Òì³ ......
1. µ±²»ÐèҪʹÓÃSessionµÄʱºòÇë¹Ø±Õ
¹Ø±ÕSessionµ±²»ÐèҪʹÓõÄʱºò
• ÈôÒª½ûÓÃÒ³µÄ»á»°×´Ì¬£¬Ç뽫@ Page Ö¸ÁîÖеÄEnableSessionState ÊôÐÔÉèÖÃΪfalse¡£ÀýÈ磬<%@ Page EnableSessionState="false" %>¡£
• ×¢ÒâÈç¹ûÒ³ÐèÒª·ÃÎʻỰ±äÁ¿£¬µ«²»´òËã´´½¨»òÐÞ ......
µÚÒ»ÖÖ
ÊÇͨ¹ýµ÷ÓÃwindow media player½øÐв¥·ÅÖîÈ磺wmv,asfµÈ¸ñʽÎļþ:
<object align=center class=OBJECT classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 height=320 id=MediaPlayer width=356>
<param name="ShowStatusBar" value="-1">
<param name="Filename" value="µçÓ°µØÖ·">
& ......
1.
Éî²ã´ÎÀ´ËµÕâ²»ÊÇ ASP.NET µÄÎÊÌ⣬ ¶øÊÇ html form µÄ submit °´Å¥¾ÍÊÇÈçºÎÉè¼ÆµÄ¡£
µ±ÄãµÄ¹â±ê½¹µã½øÈëij¸ö±íµ¥ÔªËصÄʱºò£¬»á¼¤»î¸Ã±íµ¥ÖеÚÒ»¸ö£¨Á÷²¼¾Ö˳´Ó×óµ½ÓÒ£¬´ÓÉÏÖÁÏ£© type=submit µÄ°´Å¥£¨¼ÙÈçÓУ©£¬µÈ´ýÏìÓ¦»Ø³µÊ¼þ£¬²¢Ìá½»¸Ãform
Äã¿ÉÒÔ²âÊÔһϴúÂ룺
<form action="">
<input typ ......
·ÖÒ³ÊÇ×î³£ÓõŦÄÜÖ®Ò»£¬Õâ¶Î·ÖÒ³´úÂëÊʺϳõѧÕß¡£
ÒÔÐÂÎÅ·ÖҳΪÀý£¬´úÂë¹²°üº¬Èý¸ö²¿·Ö£ºÒ»ÊÇ·ÖÒ³Ò³ÂëÏÔʾ£¬¶þÊÇÏÔʾµ±Ç°Ò³µÄÐÂÎÅ£¬ÈýÊǺǫ́´úÂë¡£
Ò»¡¢Ò³ÂëÏÔʾ
¡¡¡¡1.ÔÚºǫ́¶¨ÒåÒ»¸ö±äÁ¿£ºprotected string PageInfo = "";
¡¡¡¡2.Ö´ÐзÖÒ³£¬¸³ÖµºóÔÚǰ̨Êä³ö£º<%=PageInfo%>
¶þ¡¢ÏÔʾµ±Ç°Ò³µÄÐÂÎÅ
¡¡¡¡Ê¹Óà ......