例如: <input type="button" class="btn btn-primary" style="width: 30%" value="返回" onclick="window.location.href='/users/list'"></input>spa
onclick跳转到href对应值的URL本地地址orm
例如:<input type="submit" class="btn btn-primary" style="width: 30%;margin-left: 5%"></input>input
提交当前页面数据,常应用于form表单中it
1.若是让本页转向新的页面则用:io
<input type=button onclick=”window.location.href(‘链接’)“>form
2.若是须要打开一个新的页面进行转向,则用:class
<input type=button onclick=”window.open(‘链接’)“>cli
<input type=button value=刷新 onclick=”window.location.reload()“>表单
<input type=button value=前进 onclick=”window.history.go(1)“>im
<input type=button value=刷新 onclick=”window.history.go(0)“>
<input type=button value=后退 onclick=”window.history.go(-1)“>
<input type=button value=前进 onclick=”window.history.forward()“>
<input type=button value=后退 onclick=”window.history.back()“>
<input type=button value=后退同时刷新 onclick=”window.history.go(-1);window.location.reload()“>
三、点击按钮弹出确认alert窗口
方式一:onclick="alert('是否确认提交?'); return false;"
方式二:onclick="if (confirm('确认返回ma?')) window.location.href='/users/list'; return false;"