Here is a picture of the error. 프로젝트를 일부 변경 한 후에이 오류가 표시됩니다. 버튼을 누르면 웹 사이트 사용자를 기록하기위한 컨트롤러로 이동하게됩니다. 부트 스트랩에 레이아웃을 다시 만들고 사이트에 속한 CSS의 변경/삭제를 많이했습니다. 이것은 관련이 있지만 확실하지는 않습니다. 버튼 코드는 다음과 같습니다.잡히지 않은 TypeError : null의 'submit'메서드를 호출 할 수 없습니다.
@if (Request.IsAuthenticated) {
<text>
Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
@Html.AntiForgeryToken()
<a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
}
</text>
} else {
<ul>
<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
</ul>
}
왜 이런 일이 일어날 지 알고 계십니까?
getElementById ('logoutForm')'이 null 인 경우 양식이 존재하는지 확인하십시오. – Marthijn
보기 원본을 사용하여 로그 오프 양식 dos에 ID가 렌더링되었는지 확인하십시오. – rene
@Marthijn @rene 로그 오프가 양식에있는 것처럼 보입니다. 새로운 버전 : http://i.imgur.com/hKBdtty.png. 이전 버전에서는 CSS 파일에 다음 코드 줄이 있습니다.'#logoutForm { display : inline; }'. CSS를 읽거나 양식을 만들 수없는 것은 무엇입니까? – JazzMaster