点击按钮让所有控件Enable全为False(用javascript)
我在Asp.net的用户控件里,我想用javascript实现,当点击Button(btnSave)时,所有按钮的Enable都为False,试了多次都不行,但在不是用户控件的页面就行.就用
document.getElementById("txtCode").disabled=true;
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AcademyUC.ascx.cs" Inherits="manager_UserControl_AcademyUC" %><script language="javascript" type="text/javascript"><!--function btnAdd_onclick() { document.getElementById("txtCode").disabled=true;}// --></script><table width="658" height="180" border="1"> <tr> <td colspan="4" bgcolor="lavender"><center> 学院信息</center></td> </tr> <tr> <td colspan="4" style="height: 26px"> <input id="btnAdd" style="position: relative" type="button" value="增加" language="javascript" onclick="return btnAdd_onclick()" /> <asp:Button ID="btnModify" runat="server" Style="position: relative" Text="修改" /> <asp:Button ID="btnDelete" runat="server" Style="position: relative" Text="删除" /> <asp:Button ID="btnSave" runat="server" Style="position: relative" Text="保存" OnClick="btnSave_Click" /> <asp:Button ID="btnCancel" runat="server" Style="position: relative" Text="取消" /> </td> </tr> <tr> <td> 编号:</td> <td> <asp:TextBox ID="txtCode" runat="server" Style="position: relative; left: 1px; top: -2px;" ></asp:TextBox></td> <td rowspan="2"> 备注: </td> <td rowspan="2"> <asp:TextBox ID="txtRemarks" runat="server" Height="54px" Style="left: -5px; position: relative; top: 1px;" TextMode="MultiLine" Width="210px"></asp:TextBox></td> </tr> <tr> <td> 名称:</td> <td> <asp:TextBox ID="txtName" runat="server" Style="position: relative; left: 2px; top: 0px;"></asp:TextBox>*</td> </tr> <tr> <td colspan="4" bgcolor="lavender"><center> </center></td> </tr> <tr> <td colspan="4"> <asp:GridView ID="GridView1" runat="server" Style="position: relative" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" AutoGenerateColumns="False" > <FooterStyle BackColor="White" ForeColor="#000066" /> <RowStyle ForeColor="#000066" /> <Columns> <asp:CommandField ShowDeleteButton="True" /> <asp:BoundField DataField="AcademyCode" HeaderText="编号" /> <asp:BoundField DataField="AcademyName" HeaderText="名称" /> <asp:BoundField DataField="Remarks" HeaderText="备注" /> </Columns> <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /> </asp:GridView> </td> </tr></table>