Javascript Linkbutton的奇怪行为
每当我点击Linkbutton时,我都会在下面的屏幕截图中看到错误 注意:我没有对页面使用任何更新面板 HTMLJavascript Linkbutton的奇怪行为,javascript,c#,asp.net,Javascript,C#,Asp.net,每当我点击Linkbutton时,我都会在下面的屏幕截图中看到错误 注意:我没有对页面使用任何更新面板 HTML 有人能帮我吗?据我在图片上看到的,您试图访问表单上的属性,该属性在另一个函数中声明,而u doPostBack函数不知道。您可以做的一件事是将该局部变量从函数中取出并使其成为全局变量,以便它对任何函数都可用 为了更好地说明这一点,以下是您正在做的: function someFunctionAbove__doPostBack() { var theForm=document.f
有人能帮我吗?据我在图片上看到的,您试图访问表单上的属性,该属性在另一个函数中声明,而u doPostBack函数不知道。您可以做的一件事是将该局部变量从函数中取出并使其成为全局变量,以便它对任何函数都可用 为了更好地说明这一点,以下是您正在做的:
function someFunctionAbove__doPostBack()
{
var theForm=document.forms["romansForm"];
if(!theForm)
theForm=documents.romansForm;
}
function __doPostBack(eventTarget,eventArgument)
{
if(!theForm.onsubmit)//bla blaa
}
如您所见,uu doPostBack函数没有关于theForm变量的线索。只需将其更改为:
var theForm=null;
function someFunctionAbove__doPostBack()
{
theForm=document.forms["romansForm"];
if(!theForm)
theForm=documents.romansForm;
}
请张贴您的代码,而不是您的代码图片。。。抱歉,这是蚂蚁的帖子。你能发布一点html,至少是链接按钮吗part@mybirthname在新选项卡中打开图像并单击它。@cracker-您完整的代码标记&JS,而不仅仅是按钮控件。据我所见,将表单设置为romansForm的代码将其设置为undefined。请在uu doPostBack函数上方的代码上放置一个断点,看看该格式是否与未定义的不同?
var theForm=null;
function someFunctionAbove__doPostBack()
{
theForm=document.forms["romansForm"];
if(!theForm)
theForm=documents.romansForm;
}