如何通过url定位到页面指定位置,并带有focus选中效果

使用 hash 模式进行页面定位

one
跳转到 id="one"
two
跳转到 id="two"
three
跳转到 id="three"
four
跳转到 id="four"
five
跳转到 id="five"

使用 js 获取 url 上的 id 进行页面定位

one
跳转到 id="one"
two
跳转到 id="two"“携带参数 #two?v=1”
three
跳转到 id="three"
four
跳转到 id="four"“携带参数 #four?v=1”
five
跳转到 id="five"“携带参数 #five?v=1”