点击button 触发另一个button 事件

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        function test() {
            alert("这是普通按钮");
            //document.getElementById("bt1").onclick(); 不可用
            document.getElementById("bt1").click(); //可用

        }
        function test1() {
            alert("这是提交按钮");
            document.getElementById("bt1").click();// 可用或用jq获取
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type ="button" onclick="test()" />

    <button class="btn btn-default" onclick="test1()"><span class="glyphicon glyphicon-search"></span> 搜索</button>
    <asp:Button ID="bt1" runat="server" text="sss" OnClick="bt1_Click"/>
    </div>
    </form>
</body>
</html>

 

posted @ 2017-11-15 17:37  enych  阅读(4513)  评论(1编辑  收藏  举报