javascript函数我有脚本,在.ascx文件.JS功能:如何调用从.ascx文件
<script type ="text/javascript">
function CheckButton(){
if($('#plcholder').length > 0){
document.getElementById('<%= btIntoBasketAll.ClientID %>').style.display = 'inherit';
} else {
document.getElementById('<%= btIntoBasketAll.ClientID %>').style.display = 'none';
}
}
</script>
我想从.aspx文件中的TabPanel的OnClientClick属性称之为:
<asp:TabContainer ID="tabProductList" runat="server" ActiveTabIndex="0" OnActiveTabChanged="tabProductList_ActiveTabChanged" AutoPostBack="true">
<asp:TabPanel ID="TabProductListCatalog" runat="server" HeaderText="<%$ Resources: Resource, TabProductListCatalog %>">
</asp:TabPanel>
<asp:TabPanel ID="TabProductListPicture" runat="server" HeaderText="<%$ Resources: Resource, TabProductListPicture %>">
</asp:TabPanel>
<asp:TabPanel ID="TabProductListList" runat="server" HeaderText="<%$ Resources: Resource, TabProductListList %>" OnClientClick="return CheckButton()">
</asp:TabPanel>
</asp:TabContainer>
但这不起作用。 TabPanels只是在浏览器中消失。
“CheckButton”中的代码是否执行?你有没有尝试在那里放置一个'console.log'? –
@DanDumitru它不会。这是一个问题 - 如何调用放在ascx中的aspx函数。 –