查看文章
 
asp.net 回车提交信息另类解决样例
2006-11-19 10:29

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
    function keyDown()
    {
        var e=event.srcElement;
        if(event.keyCode==13)
        {
         document.getElementById("Button1").click();
        }
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server"  onkeydown="keyDown"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        <input style="display:none"  />
    </form>
</body>
</html>
 

红色标记的很关键要不提交是不成功的。还请高手指点!    


类别:asp.net||添加到搜藏 |分享到i贴吧|浏览(1959)|评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
     

   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu