简体   繁体   中英

Return on clicked element when the page back to previous

I have a page with table consist hundreds of rows. Each row is a link which is opened a new page.

Is it possible if I'm browsing the table and click on some link which is somewhere on the bottom or middle of the table when I hit back button on the browser to redirect me back to that link which is clicked?

Generally I know how I can make onClick event on the button but I'm not sure that this is what I need

<input action="action" onclick="window.history.go(-1); return false;" type="button" value="Back" />

The table is simple one

<table class="stripe">
<tr class="TableEvenLines">
    <td id="letter-a">
        <a href="example.php?id=1">Link 1</a>
    </td>
    <td>
        <a href="example.php?id=2">Link 2</a>
    </td>
</tr>
</table>

window.history.go(-1)和window.history.back()之间的区别是back()仅返回1页,而go()则相对于您作为参数传递的页数当前页面。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM