mvc跳转到别的页

JavaScript012

mvc跳转到别的页,第1张

到了前台,不用考虑MVC的因素,

<a href="/list/page2">go</a>

js,在A页里写上

<script>

function goB()

{

window.location=="/list/page2"

}

</script>

搞个按钮 点击事件为 <input type=button onclick="goB()">不就行了

可以用form的submit <form action="index">

在controller里面的action里面 Index( redirectiontoAction("要跳转的页面"))

也可以直接onclick()事件,在js里面 window.location.href=“要跳转的页面”

在action方法中,添加完成后使用 return content("<script>alert('添加成功!')window.location='其他页面路径'</script>")这是在后台用的,应该算js吧,我一直用的,不是前台