大家看一下这是.net的漏洞还是程序有问题,我一时也没搞清,只知道这问题挺怪的

 

代码如下:

1.  WebForm1.aspx

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication4.WebForm1" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<HTML>

<HEAD>

<title>WebForm1</title>

        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

        <meta name="CODE_LANGUAGE" Content="C#">

        <meta name="vs_defaultClientScript" content="JavaScript">

        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

        <script language="javascript">

        function aa()

               {

              

               //document.all.Label1.innerHTML="Ok";

               //alert("aa");

               document.getElementById('Button2').click();

               }

</script>

</HEAD>

<body MS_POSITIONING="GridLayout">

        <form id="Form1" method="post" runat="server">

        <FONT face="宋体">

               <asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 304px; POSITION: absolute; TOP: 64px" runat="server"></asp:Label>

               <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 136px" runat="server"

               Text="Button1"></asp:Button>

               <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 320px; POSITION: absolute; TOP: 208px" runat="server"

               Text="Button2"></asp:Button></FONT>

</form>

</body>

</HTML>

2.  WebForm1.aspx.cs

Page_Load中

private void Page_Load(object sender, System.EventArgs e)

     {

          if(!IsPostBack)

         {

              this.Button1.Attributes.Add("onclick","aa()");

         }

}

 

添加事件Button2

private void Button2_Click(object sender, System.EventArgs e)

{

     this.Label1.Text="Ok";

}

代码非常简单
运行结果



单击”Button1”按钮,Button2事件中添加断点如下


 

是能够进入Button2事件的(应该说Label1的值是”Ok”

但结果会是



不知道Label1为空,为什么有谁可以解释一下吗??
源代码:

posted on 2005-10-24 21:05  surprise  阅读(1151)  评论(4编辑  收藏  举报

导航