我想在选项卡为 2 时隐藏按钮。总是出错。
<script type="text/javascript">
function clientActiveTabChanged(sender, args) {
if ((sender.get_activeTabIndex()) == '2')
{
alert(sender.get_activeTabIndex());
var messageElement = document.getElementById('<%= divMessage.clientID%>').value;
messageElement.style.display = 'block';
}
}
</script>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"
EnableScriptGlobalization="True"></asp:ToolkitScriptManager>
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"
Width="100%" BorderStyle="None" OnClientActiveTabChanged="clientActiveTabChanged">
<asp:TabPanel runat="server" ID="TabPanel1">
<HeaderTemplate>Test1</HeaderTemplate>
<ContentTemplate></ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="TabPanel2">
<HeaderTemplate>Test2</HeaderTemplate>
<ContentTemplate></ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="TabPanel3">
<HeaderTemplate>Test3</HeaderTemplate>
<ContentTemplate></ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
<div runat="server" id="divMessage" style="display: none;">
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>