ASP.net¿Ø¼þ·ÖÀà
[±¾¿Î±Ê¼Ç×ÊÔ´] http://download.csdn.net/source/1850967
ASP.net¿Ø¼þ·ÖÀࣺ
1¡¢HTML¿Ø¼þ System.Web.UI.Htmlcontrols
ÆÕͨHTML½Å±¾¿Ø¼þ£¬ÊôÓÚ¿Í»§¶Ë¿Ø¼þ£¬ÓÃÓÚ¿Í»§¶Ë½âÊÍÒ³ÃæµÄÏÔʾµÄÄÚÈÝ
Ò²¿ÉÒÔת»¯³É·þÎñÆ÷¿Ø¼þ£¬Ö»ÐèÒª¼ÓÉÏÊôÐÔ runat="server"
È磺Îı¾¿òÅäºÏ°´Å¥Ê¹ÓÃ
ÐÕÃû: <input id="txtUserName" name="txtUserName" type="text" />
<input id="btnSubmit" type="button" value="ÏÔʾ" onclick="show1()"/>
½Å±¾²¿·Ö´úÂëΪ£º
<mce:script type="text/javascript"><!--
function show1()
{
var userName = document.getElementById("txtUserName").value;
if(userName != "")
alert("ÄúÊäÈëµÄÐÕÃûÊÇ:"+userName);
else
alert("±ð¶ºÁË,Äú²»Ã»ÊäÈëÄØ!");
}
// --></mce:script>
ÔÚJavaScriptÖÐÎÒÃǸù¾ÝÔªËصÄidÀ´¶¨Î»µ½ÔªËØ£¬ÔÙͨ¹ýÔªËصÄvalue¡¢innerText¡¢innerHTML¡¢styleµÈÊôÐÔÀ´
¸Ä±äÔªËØ»ò×öһЩ´¦Àí¹¤×÷¡£ÄÇô¶ÔÓÚÏñµ¥Ñ¡°´Å¥¡¢¶àÑ¡°´Å¥µÈ×éºÏÐÔÖʵĿؼþ£¬¾ÍÒª¸ù¾ÝÆä×éÃûÀ´»ñÈ¡ÔªËØ£¬ÈçÏ£º
ÄúµÄÐËȤ°®ºÃ:<br />
<input name="hover" type="checkbox" value="tour"/>ÂÃÓÎ
<input name="hover" type="checkbox" value="net"/>ÉÏÍø
<input name="hover" type="checkbox" value="reading" />ÔĶÁ
<input id="btnHover" type="button" value="ÏÔʾ" onclick="show2()"/>
½Å±¾´úÂë:
<mce:script type="text/javascript"><!--
function show2()
{
var hovers = document.getElementsByName("hover");
var _hovers = new Array();
var info = "ÄúµÄÐËȤ°®ºÃΪ:" ;
for(var i=0;i<hovers.length;i++)
if(hovers[i].checked)
_hovers[i] = hovers[i].value;
for(var t in _hovers)
info += _hovers[t] + "\t";
alert(info);
}
// --></mce:script>
2¡¢Web¿Ø¼þ System.Web.UI.Controls
·þÎñÆ÷¿Ø¼þ£¬Ìṩ·á¸»µÄ¹¦ÄÜ£¬¿ÉÖ´Ðи´ÔÓµÄÒ³ÃæÇëÇó
Web·þÎñÆ÷¿Ø¼þÒÔasp:¿ªÍ·£¬³ÆΪ±ê¼Çǰ׺£¬ºóÃæÊǿؼþÀàÐÍ£¬
ÀýÈç:<asp:Label ID="lblTitle" runat="server">&l
Ïà¹ØÎĵµ£º
²»Öª²»¾õ¹¤×÷ÒѾÁ½Äê¶àÁË£¬Ò»Ö±Ïë°Ñ¹ýÈ¥µÄµãµãµÎµÎ»ýÀ۵ľÑéдÏÂÀ´£¬µ«ÊÇÒ»Ö±ÄÑÒÔÍê³É£¬Ò»ÊÇʱ¼äµÄÏÞÖÆ£¬ÔÙÊÇËùÒԵö«Î÷»¹ÊDZȽÏÔÓÂÒ£¬Ò»Ê±ÄÑÒÔÕûÀí¡£ÏÂÃæ¾Í´ÓASP.NETÓ¦ÓóÌÐòÉú´æÖÜÆÚ¿ªÊ¼Ì¸Æð£¬Ö÷ÒªÊÇÒÔ´ËΪһ¸ö¿ªÍ·£¬ÀϲûÊö¸öÈ˵ÄһЩ¾Ñé¾Ñé̸֮ºÍ¶Ô²Î¿¼Ò»Ð©×ÊÁϵÄÀí½â¡£
Ê×ÏÈ£¬ÎÊÌâÒ»£ºÎÒÃÇ´ò¿ªÒ»¸öÍ ......
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.location.href=document.URL; < /script>" ); } ......
1¡¢Êý¾Ý¿Ø¼þ£¨ÈçDataGrid/DataListµÈ¿Ø¼þ£©¸ñʽ»¯ÈÕÆÚ·½·¨£º
e.Item.Cell[0].Text = Convert.ToDateTime(e.Item.Cell[0].Text).ToShortDateString();
//Ö¸¶¨ÁУ¨µÚ1ÁУ©¸ñʽ»¯ÈÕÆÚ
2¡¢ÓÃStringÀàת»»ÈÕÆÚÏÔʾ¸ñʽ£º
String.Format( "yyyy-MM-dd ",yourDateTime);
3¡¢ÓÃConvert·½·¨×ª»»ÈÕÆÚÏÔʾ¸ñʽ£º
Convert.ToDat ......
Èç¹ûÓû§Ê¹ÓõÄä¯ÀÀÆ÷Ö§³Ö¶¯Ì¬ HTML (DHTML)£¬Ôò ASP.NET ÑéÖ¤¿Ø¼þ¿ÉÒÔʹÓÿͻ§¶Ë½Å±¾À´Ö´ÐÐÑéÖ¤¡£ÒòΪÕâÖֿؼþ¿ÉÒÔÌṩ¼°Ê±·´À¡£¨ÎÞÐèµ½·þÎñÆ÷µÄÍù·µ¹ý³Ì£©£¬ËùÒÔÓû§»á¸Ð¾õµ½Ò³µÄÐÔÄÜÓÐËù¸ÄÉÆ¡£
ÔÚ´ó¶àÊýÇé¿öÏ£¬ÎÞÐè¶ÔÒ³»òÑéÖ¤¿Ø¼þ×÷³öÈκθü¸Ä±ã¿ÉʹÓÿͻ§¶ËÑéÖ¤¡£¿Ø¼þ½«×Ô¶¯¼ì²âä¯À ......