JavaScript代码:

function showdlgBox()
{
    var whiteBox = document.getElementById("white-background");
    var dlgbox = document.getElementById("dlgBox");
    whiteBox.style.display = "block";
    dlgbox.style.display = "block";`enter code here`
    var winwidth = window.innerWidth;
    var winHighet = window.innerHeight;`enter code here`
    dlgbox.style.left = (winwidth / 2) - 480 / 2 + "px";
    dlgbox.style.top = "150px";
}


的HTML:

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>


如何在linkbutton上调用此javascript?

最佳答案

说明:

据我了解,

OnClick="LinkButton1_Click"


被链接到后端(服务器端)功能-这就是为什么发生回发的原因。

解:

也许尝试将其取出。或者,使用纯HTML锚标记:

<a id='LinkButton1' href='javascript:void(0)'></a>


祝好运

07-24 20:06