[英]How can i redirect the user to a 'section' on an html page from another html page?
當用戶單擊subpage.html頁面上的后退按鈕時,我想將用戶重定向到index.html頁面上的“ #features”部分。 我怎樣才能做到這一點?
您可以通過內部頁面錨來實現。 嘗試這個:
在subpage.html中
window.location.href= "index.html#features";
在index.html中
<a id="features">row 15 data here.</a>
這就是我解決問題的方式。 只需將按鈕包裝上帶有href="/index.html#feature"
a
標簽即可。 如果兩個頁面都在同一目錄中,請使用href="./index.html#feature"
在javascript中使用scrollIntoView
函數。 在此處查閱文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.