BitComet web 插件和 flash get web 插件 对脚本的影响
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="if(!confirm('确定删除吗!')){event.returnValue=false;}" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" /></div>
</form>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="if(!confirm('确定删除吗!')){event.returnValue=false;}" OnClick="Button1_Click" />
<asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" /></div>
</form>
今天程序中发现一个怪异的问题
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.Button2.Attributes.Add("onclick", "return confirm('确定删除吗!')");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Response.Write("button1");
}
protected void Button2_Click(object sender, EventArgs e)
{
this.Response.Write("button2");
}
}
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.Button2.Attributes.Add("onclick", "return confirm('确定删除吗!')");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
this.Response.Write("button1");
}
protected void Button2_Click(object sender, EventArgs e)
{
this.Response.Write("button2");
}
}
必须像 button1 那样的脚本才能正常执行,
可是像button2 无论点取消还是确定都要执行,
那样我一直用了好久啊,最后才发现是web 插件的问题,卸载掉就都好了。。。