1
history.go()関数とwindow.location.hrefを使用せずにブラウザを前のページに戻すためのボタンのクリックイベントとして追加できる関数はありますか?ボタンをキャンセルすると前のページにリダイレクト
<input type="submit" name="cancel" value="cancel" onclick="history.go(-1)"/>
history.go()関数とwindow.location.hrefを使用せずにブラウザを前のページに戻すためのボタンのクリックイベントとして追加できる関数はありますか?ボタンをキャンセルすると前のページにリダイレクト
<input type="submit" name="cancel" value="cancel" onclick="history.go(-1)"/>
ほとんどのブラウザは、デフォルト、代わりのhistory.go(-1)または同様でそうであるように、このソリューションは、リンク先のページホバー上のURLを示すという利点があります。
1 <script>
2 document.write('<a href="' + document.referrer + '">Go Back</a>');
3 </script>'
試用版
<input type="submit" name="cancel" value="cancel" onclick="goPrev()"/>
<script>
function goPrev()
{
window.history.back();
}
</script>