gpt4 book ai didi

javascript - 如何在asp上调用JS函数:LinkButton click event

转载 作者:行者123 更新时间:2023-12-01 03:02:57 27 4
gpt4 key购买 nike

我有这个 JS 函数,每当页面加载时就会加载:

<script type="text/javascript">

window.onload = function () {
<asp:Literal ID="LiteralGraph01" runat="server"></asp:Literal>
<asp:Literal ID="LiteralGraph_ft01" runat="server"></asp:Literal>


</script>

如何通过单击 asp:LinkBut​​ton 来调用此函数?该链接按钮称为 filtroCombinado:

<asp:LinkButton ID="filtroCombinado" runat="server"></asp:LinkButton>

感谢您的帮助!

最佳答案

<asp:LinkButton...呈现为 anchor ( <a href=... )。如果你想运行一些JS onload onclick做这样的事情。

<script type="text/javascript">

window.onload = function myFunc () {//nobody blames you when you name the function
<asp:Literal ID="LiteralGraph01" runat="server">some data I fill in from server (and replace this text)</asp:Literal>
<asp:Literal ID="LiteralGraph_ft01" runat="server"></asp:Literal>
return false; //avoid sending request to the server
}//close the function
</script>
...
//do something before sending request to the server
<asp:LinkButton ID="filtroCombinado" runat="server" OnClientClick="return myFunc();"></asp:LinkButton>

关于javascript - 如何在asp上调用JS函数:LinkButton click event,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46355450/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com