遷移我的MVC3(CSS)項目MVC5(剃刀),我使用:Razor視圖MVC 5 JavaScript的 - 解決的document.getElementById
<% if ((bool)this.ViewData["ReadOnly"] != true)
{ %>
document.getElementById("NextAction").value = nextAction;
document.getElementById("VisitForm").submit();
<% } else { %>
window.location = nextAction;
<% } %>
我把它修改爲:
@if ((bool)this.ViewData["ReadOnly"] != true)
{
document.getElementById("NextAction").value = nextAction;
document.getElementById("VisitForm").submit();
} else {
window.location = nextAction;
}
無法解決文檔或窗口?
你最好從這個答案中刪除Stack Snippet;他們只適用於HTML,CSS和JS,而不是ASP.NET MVC。否則,很好的答案 – ArtOfCode 2014-11-03 18:22:15