JavaScriptÅжÏÎÊÌâ¡£¡£¡£ - .NET¼¼Êõ / ASP.NET
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string strMsg = "ÄãÈ·¶¨ÒªÉ¾³ýÂð£¿";
int flag = 0;
Response.Write("<Script Language='JavaScript'>if ( window.confirm('" + strMsg + "')) { "+(flag = 1)+"} else {" +(flag = 0) +"};</script>");
if (flag == 0)
{
e.Cancel = true;
}
}
ÎÒÏëÔÚgridviewÖеãɾ³ýʱ¡£µ¯³ö¶Ô»°¿òÅжÏÊÇ·ñɾ³ý£¿È»ºó¿´ÊÇ·ñÖ´ÐвÙ×÷¡£¡£ÎªÊ²Ã´¾ÍÊDz»ÐÐÄØ
C# code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[5].Attributes.Add("onclick", "return confirm('ÄãÈ·¶¨ÒªÉ¾³ýÂð£¿')");
}
}
//Cells[5]Õâ¸ö¶ÔÓ¦ÄãµÄɾ³ý¿Ø¼þËùÔÚµÄÀ¸Î»Ë³Ðò
ÄãµÄɾ³ýÊÇʹÓõÄcommandfield»¹ÊÇtemplatefield£¬×îºÃÄÜÌù³ö´úÂë¡£
ΪʲôҪResponse.Write£¿
ΪʲôҪe.Cancel=true£¿
Ë¿ºÁ¿´²»³öµÀÀí¡£
ÄãÕâ¾äÖеÄjsûÓзµ»Ø¿Í»§¶Ë£¬ÈçºÎÖ´ÐУ¿
=============
1Â¥Õý½â
ÏȲ»ËµÎªjavascript²»Ö´ÐÐ.
Ä㾹Ȼ°Ñ¿Í»§¶ËjavascriptµÃµ½µÄflag = 0/1 Ö±½Ó¸³Öµ¸øÁ˺ǫ́µÄC#´úÂëÖеÄflag±äÁ¿?
Ïà¹ØÎÊ´ð£º
ÇóÒ»¸öjavascript½Å±¾..
µ±µã»÷Õâ¸ö<a>Ìí¼Ó¸½½ü</a>Á´½Óʱ¾Í»áÌí¼Ó¶àÒ»ÐÐÉÏ´«¿òºÍ°´Å¥,ºÍ×îºóÒ»¸öÅԱ߻áÏÔʾ"È¡Ïû"µÄÁ´½Ó,µã»÷Õâ¸öÈ¡Ïû¾Í»áÈ¥µô×îºóÒ»ÐÐ,Ò»¸öÕâ¸ö½Å±¾Ôõôд?Íò·Öлл..
Ò ......
ÎÒÓõÄÊÇGodaddyµÄ·þÎñ,ʹÓÃ
C# code:
HttpRuntime.UnloadAppDomain();
À´ÖØÆô³ÌÐò»áÅ׳öÒì³£,Ó¦¸ÃÊÇȨÏÞ²»¹»,Çë½Ì´ó¼Ò»¹ÓÐûÓÐÆäËûµÄ°ì·¨?
using System.ServiceProcess;
public void ResetAsp ......
ÔÚJSPÒ³ÃæÓÐÒ»¸ö<input type="hidden" name="index" value="0">/>¿Ø¼þ
µ±ÎÒÓÃÏÂÃæµÄJavaScriptº¯Êý¸Ä±äÆävalueµÄÖµµÄʱºò Èç¹ûÂú×ãÌõ¼þ£¨¼´i>=3µÄʱºò£©ÎªÊ²Ã´valueµÄ ......
ÎÒÏëÎÊÒ»ÏÂÈçºÎÔÚ»ðºüÖйرգ¬·Ç½Å±¾´ò¿ªµÄÒ³Ã棬ºÃÏñwindow.close()²»¹ÜÓÃO(¡É_¡É)O~£¬
°Ù¶Èһϣ¬×Ô¼ºÊÔÊÔ
<script language="javascript" type="text/javascript">
& ......
O O O O O O
|.......| |........| |.......|
| | |
O O ......