button多个事件处理

    技术2022-05-11  15

    有时候需要一个button按钮,点击跳到别的页面,又不想多写js代码,如下代码可以实现:

    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()">


    最新回复(0)