Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.net×¢²áJavascriptµÄ·½·¨

1¡¢IsStartupScriptRegistered£º¶ÔÏóÊÇ·ñ×¢²áÁËÆôÓýű¾¡£
2¡¢IsClientScriptBlockRegistered£º¶ÔÏóÊÇ·ñ×¢²áÁË¿Í»§¶Ë½Å±¾¿é¡£
3¡¢IsClientScriptIncludeRegistered£º¶ÔÏóÊÇ·ñ×¢²áÁË¿Í»§¶Ë½Å±¾°üº¬¡£
µÚÒ»¸öÀý×Ó£º
string info = "<script>alert('ÄãºÃÂð£¿');</script>";
//ÅжÏʼþÊÇ·ñ±»×¢²á£¬Ð´ÈëÇøÓò£º<body>----<script></body>
if (!Page.ClientScript.IsStartupScriptRegistered("test"))
{
//¶¯Ì¬×¢²á²¢Ö´ÐÐJavascript
Page.ClientScript.RegisterStartupScript(this.GetType(), "test", info);
}
µÚ¶þ¸öÀý×Ó£º
aspxÎļþ£º
ÐÕÃû£º<input id="txtUserName" type="text" />
<input id="btnSubmit" type="button" value="È·¶¨" onclick="salert(txtUserName.value)" />
csÎļþ£º
string info = "function salert(userName){alert('ÄãµÄÃû×Ö£º' + userName)}";
//ÅжÏtestÊÇ·ñÒÑ×¢²á
if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "test"))
{
//¶¯Ì¬×¢²áJavascript
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "test", info, true);
}
µÚÈý¸öÀý×Ó£º
aspxÎļþ£º
ÐÕÃû£º<input id="txtUserName" type="text" />
<input id="btnSubmit" type="button" value="È·¶¨" onclick="salert(txtUserName.value)" />
Jscript.js
function salert(userName)
{
alert("ÄãµÄÃû×Ö" + userName);
}
csÎļþ£º
//ÅжÏtestÊÇ·ñÒÑ×¢²á
if (!Page.ClientScript.IsClientScriptIncludeRegistered(this.GetType(), "test"))
{
//¶¯Ì¬×¢²áJavascript
Page.ClientScript.RegisterClientScriptInclude("test", "Jscript.js");
}
Ïêϸ³ö´¦²Î¿¼£ºhttp://www.jb51.net/article/15117.htm


Ïà¹ØÎĵµ£º

Javascript±äÁ¿×÷ÓÃÓò

ÇëÏÈ¿´ÏÂÌ⣺
if(true)
{
     a = 1;
}
alert(a);  //Êä³öɶ£¿
if(true)
{
    var a = 1; 
}
alert(a);  //ÕâÓÖÊä³öʲô£¿
ÔÚfirefox3.5Ï£¬µÚÒ»¸öÊä³ö1;µÚ¶þ¸öÊä³öundefined£¡£¡£¡
ΪɶÄØ£¿ºÇºÇ£¬±¾ÈËÔÚ´Ë°àÃÅŪ¸«Ò»Ï£º
Ò»°ãÇé¿öÏÂȱʡvarÉùÃ÷ʱ£¬Ä¬È ......

ASP.NET½ûÓÃURL»º´æ

ÔÚÒ»¸öÏîÄ¿¿ª·¢ÖУ¬showdialogµ¯³ö¶Ô»°¿òʱ£¬ÎÒ֮ǰÐ޸ĹýµÄÊý¾Ý²»»á¼°Ê±¸üУ¡
ʹÓýûÓÃURL»º´æµÄ·½·¨,½â¾öÕâ¸öÎÊÌâ
ÔÚasp.netÒ³ÃæµÄºǫ́
if (!IsPostBack)
 {
            Response.Buffer = true;
         ......

Ïò ASP.NET Web ·þÎñÆ÷¿Ø¼þÌí¼Ó¿Í»§¶Ë½Å±¾Ê¼þ

¸üУº2007 Äê 11 Ô ¿ÉÒÔÏñ¶Ô HTML ÔªËØÄÇÑù£¬ÒÔÉùÃ÷·½Ê½Ïò ASP.NET ÍøÒ³ÉϵĿؼþÌí¼Ó¿Í»§¶Ë½Å±¾¡£»òÕߣ¬Èç¹ûʼþ»ò´úÂëÒÀÀµ½öÔÚÔËÐÐʱ¿ÉÓõÄÐÅÏ¢£¬¿ÉÒÔͨ¹ý±à³Ì·½Ê½Ïò ASP.NET Web ·þÎñÆ÷¿Ø¼þÌí¼Ó¿Í»§¶Ë½Å±¾Ê¼þ¡£ ˵Ã÷£º ¿ÉÒÔÔÚ¿Í»§¶Ë½Å±¾ÖÐͨ¹ý ID ÒýÓÿؼþ¡£Óйظü¶àÐÅÏ¢£¬Çë²Î¼û ASP.NET ÍøÒ³ÖеĿͻ§¶Ë½Å±¾¡£ Ïò ......

ASP.NETÅäÖÃÎļþWeb.config Ïêϸ½âÊÍ

Ò»¡¢ÈÏʶWeb.configÎļþ
Web.configÎļþÊÇÒ»¸öXMLÎı¾Îļþ£¬ËüÓÃÀ´´¢´æ ASP.NET Web Ó¦ÓóÌÐòµÄÅäÖÃÐÅÏ¢£¨Èç×î³£ÓõÄÉèÖÃASP.NET Web Ó¦ÓóÌÐòµÄÉí·ÝÑéÖ¤·½Ê½£©£¬Ëü¿ÉÒÔ³öÏÖÔÚÓ¦ÓóÌÐòµÄÿһ¸öĿ¼ÖС£µ±Äãͨ¹ýVB.NETн¨Ò»¸öWebÓ¦ÓóÌÐòºó£¬Ä¬ÈÏÇé¿öÏ»áÔÚ¸ùĿ¼×Ô¶¯´´½¨Ò»¸öĬÈϵÄWeb.configÎļþ£¬°üÀ¨Ä¬ÈϵÄÅäÖÃÉèÖã¬Ë ......

asp.net¼ì²âÍøÒ³ÌØÐÔ

´úÂëÈçÏ£º
System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities\n"
"Type = " + browser.Type ;
"Name = " + browser.Browser ;
"Version = " + browser.Version ;
"Major Version = " + browser.Ma ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ