【问题标题】:asp.net webforms + jquery = can't get button pressasp.net webforms + jquery = 无法按下按钮
【发布时间】:2011-02-01 15:05:08
【问题描述】:

想在母版页中包含 jquery,但一旦我这样做了 - 我的登录页面停止工作......在 chrome 控制台中我得到:

uncaught TypeError: Cannot read property 'onsubmit' of null

从堆栈中我可以看到它在这里:

Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', document.getElementById('aspnetForm'));

在火狐中:

this._form is null
this._onsubmit = this._form.onsubmit; 

该错误在 ScriptResource.axd?=...

这导致我不能只点击登录按钮 - 它什么都不做......另一方面 - 一切都在 Opera 中运行......更好 - 如果我要删除:

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript" />      

然后一切正常(也尝试了其他版本的 jquery)......现在最好的是其他页面 - 也有按钮和事件,工作......我什至更改了登录页面不使用登录控件......它仍然不起作用......我现在真的很困惑......

【问题讨论】:

  • 请在此处提供加载脚本的顺序

标签: asp.net jquery forms submit


【解决方案1】:

我的同事偶然发现了一个解决方案……如果你改变:

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript" /> 

<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.5.min.js" type="text/javascript"></script>

它神奇地开始工作......现在......这应该是xhtml......谁能向我解释为什么这里有区别?!

【讨论】:

猜你喜欢
  • 2021-08-10
  • 2016-03-26
  • 1970-01-01
  • 2020-12-25
  • 1970-01-01
  • 2012-07-19
  • 2021-12-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多