gpt4 book ai didi

javascript - Linkbutton 的奇怪行为

转载 作者:行者123 更新时间:2023-11-28 07:44:55 25 4
gpt4 key购买 nike

每当我点击链接按钮时,我都会收到下面屏幕截图中的错误。

enter image description here

注意:我没有使用任何更新面板与页面。

HTML

<asp:LinkButton ID="btnSend" runat="server" CssClass="button submitButton" ValidationGroup="SurveyQuestion" CausesValidation="true" OnClick="SendQuestion_Click"></asp:LinkButton> <span>Submit</span></asp:LinkButton>

有人可以帮我解决这个问题吗?

最佳答案

据我在图片中看到的,您正在尝试访问 theForm 上的一个属性,该属性是在 __doPostBack 未知的另一个函数中声明的。功能。您可以做的一件事就是将该局部变量从函数中取出并将其设为全局变量,以便任何函数都可以使用它。

为了更好地说明这一点,这就是您正在做的事情:

function someFunctionAbove__doPostBack()
{
var theForm=document.forms["romansForm"];
if(!theForm)
theForm=documents.romansForm;
}

function __doPostBack(eventTarget,eventArgument)
{
if(!theForm.onsubmit)//bla blaa
}

如您所见,__doPostBack 函数对 theForm 变量没有任何线索。只需将其更改为:

    var theForm=null;
function someFunctionAbove__doPostBack()
{
theForm=document.forms["romansForm"];
if(!theForm)
theForm=documents.romansForm;
}

关于javascript - Linkbutton 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27539335/

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