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