关于默认按钮

我做了个登陆的页面,上面只有一个button 是个webcontrol,另外还有个文本框,可是在文本框输入回车的时候却不是激发 button的onclick事件。。这是为什么呢?直接点击这个button是可以正确执行的,没有问题。
aspx文件如下
ExpandedBlockStart.gif ContractedBlock.gif <% dot.gif @ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login"  %>
None.gif
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
None.gif
< HTML >
None.gif    
< HEAD >
None.gif        
< title > Login </ title >
None.gif        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
None.gif        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
None.gif        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
None.gif        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
None.gif    
</ HEAD >
None.gif    
< body  MS_POSITIONING ="GridLayout" >
None.gif        
< form  id ="Form1"  method ="post"  runat ="server" >
None.gif            
< asp:label  id ="Label1"  style ="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px"  runat ="server" > 用户名 </ asp:label >
None.gif            
< asp:label  id ="Label2"  style ="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px"  runat ="server" > 密码 </ asp:label >
None.gif            
< asp:textbox  id ="TextBoxPassword"  style ="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px"
None.gif                runat
="server"  TextMode ="Password" ></ asp:textbox >
None.gif            
< asp:button  id ="ButtonLogin"  style ="Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px"
None.gif                runat
="server"  Text ="登陆"  Width ="72px"  Height ="24px" ></ asp:button >
None.gif            
< asp:dropdownlist  id ="DropDownListUsername"  style ="Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px"
None.gif                runat
="server"  Width ="152px"  Height ="24px"  ForeColor ="Black" ></ asp:dropdownlist >
None.gif            
< asp:Label  id ="LabelLoginHints"  style ="Z-INDEX: 106; LEFT: 200px; POSITION: absolute; TOP: 136px"
None.gif                runat
="server"  Height ="16px"  Width ="160px"  Visible ="False" ></ asp:Label ></ form >
None.gif    
</ body >
None.gif
</ HTML >

生成的html页面源代码如下

None.gif
None.gif
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  >
None.gif
< HTML >
None.gif    
< HEAD >
None.gif        
< title > Login </ title >
None.gif        
< meta  content ="Microsoft Visual Studio .NET 7.1"  name ="GENERATOR" >
None.gif        
< meta  content ="C#"  name ="CODE_LANGUAGE" >
None.gif        
< meta  content ="JavaScript"  name ="vs_defaultClientScript" >
None.gif        
< meta  content ="http://schemas.microsoft.com/intellisense/ie5"  name ="vs_targetSchema" >
None.gif    
</ HEAD >
None.gif    
< body  MS_POSITIONING ="GridLayout" >
None.gif        
< form  name ="Form1"  method ="post"  action ="login.aspx"  id ="Form1" >
None.gif
< input  type ="hidden"  name ="__VIEWSTATE"  value ="dDwtMjAyODkxODIxNDt0PDtsPGk8MT47PjtsPHQ8O2w8aTw5Pjs+O2w8dDx0PHA8cDxsPERhdGFNZW1iZXI7RGF0YVRleHRGaWVsZDs+O2w8WW9uZ2h1O21pbmdjaGVuZzs+Pjs+O3Q8aTwxPjtAPGFkbWluOz47QDxhZG1pbjs+Pjs+Ozs+Oz4+Oz4+Oz6mXAwirhGRHCGNRsa9w1rNH6t3GA=="   />
None.gif
None.gif            
< span  id ="Label1"  style ="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px" > 用户名 </ span >
None.gif            
< span  id ="Label2"  style ="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px" > 密码 </ span >
None.gif            
< input  name ="TextBoxPassword"  type ="password"  id ="TextBoxPassword"  style ="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px"   />
None.gif            
< input  type ="submit"  name ="ButtonLogin"  value ="登陆"  id ="ButtonLogin"  style ="height:24px;width:72px;Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px"   />
None.gif            
< select  name ="DropDownListUsername"  id ="DropDownListUsername"  style ="color:Black;height:24px;width:152px;Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px" >
None.gif    
< option  value ="admin" > admin </ option >
None.gif
None.gif
</ select >
None.gif            
</ form >
None.gif    
</ body >
None.gif
</ HTML >
None.gif

可以看到input type=submit 的确在 form里面,可是就是没有效果,这是为什么呢?
多谢各位达人了

转载于:https://www.cnblogs.com/hezhenwei/archive/2005/02/20/106456.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值