hnc*_*ncl 1 javascript asp.net-mvc razor
将我的 MVC3 (aspx) 项目迁移到 MVC5 (razor),我使用:
<% if ((bool)this.ViewData["ReadOnly"] != true)
{ %>
document.getElementById("NextAction").value = nextAction;
document.getElementById("VisitForm").submit();
<% } else { %>
window.location = nextAction;
<% } %>
Run Code Online (Sandbox Code Playgroud)
我将其修改为:
@if ((bool)this.ViewData["ReadOnly"] != true)
{
document.getElementById("NextAction").value = nextAction;
document.getElementById("VisitForm").submit();
} else {
window.location = nextAction;
}
Run Code Online (Sandbox Code Playgroud)
无法解析文档或窗口?
您缺少脚本标签。像这样:
@if ((bool)this.ViewData["ReadOnly"] != true)
{
<script>
document.getElementById("NextAction").value = nextAction;
document.getElementById("VisitForm").submit();
</script>
}
else
{
<script>
window.location = nextAction;
</script>
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9922 次 |
| 最近记录: |