input的button类型,点击页面跳转
2019獨角獸企業重金招聘Python工程師標準>>>
?
一、input type=button 不做任何操作
? ? 例如:?<input type="button" class="btn btn-primary" style="width: 30%" value="返回" οnclick="window.location.href='/users/list'"></input>
? ? onclick跳轉到href對應值的URL本地地址
二、input type=submit 提交頁面數據
? ? 例如:<input type="submit" class="btn btn-primary" style="width: 30%;margin-left: 5%"></input>
? ? 提交當前頁面數據,常應用于form表單中
?
拓展資料:
????1.如果讓本頁轉向新的頁面則用:
????????<input type=button οnclick=”window.location.href(‘連接’)“>
????2.如果需要打開一個新的頁面進行轉向,則用:
????????<input type=button οnclick=”window.open(‘連接’)“>
????????<input type=button value=刷新 οnclick=”window.location.reload()“>
????????<input type=button value=前進 οnclick=”window.history.go(1)“>
????????<input type=button value=刷新 οnclick=”window.history.go(0)“>
????????<input type=button value=后退 οnclick=”window.history.go(-1)“>
????????<input type=button value=前進 οnclick=”window.history.forward()“>
????????<input type=button value=后退 οnclick=”window.history.back()“>
????????<input type=button value=后退同時刷新 οnclick=”window.history.go(-1);window.location.reload()“>
? ? 3、點擊按鈕彈出確認alert窗口
????????方式一:οnclick="alert('是否確認提交?'); return false;"
????? ? 方式二:οnclick="if (confirm('確認返回ma?')) window.location.href='/users/list'; return false;"
?
?
?
?
轉載于:https://my.oschina.net/u/3625745/blog/3002900
總結
以上是生活随笔為你收集整理的input的button类型,点击页面跳转的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 二十九、K8s最小服务漏洞3-gViso
- 下一篇: 超声检测的不同扫描方式