【发布时间】:2016-04-30 19:32:09
【问题描述】:
http://torasbo.se/lumos/blog20.html 包含一个简单的搜索表单。
<form class="searchform" method="get">
<input type="text" id="s2" name="s" value="type and hit enter" onfocus="this.value=''" onblur="this.value='type and hit enter'"/>
</form>
如果我输入 - Benjamin - 什么也找不到,文件栏显示 blog20.html?s=Benjamin。
如果我将文件栏更改为blog20.html?s=#Benjamin,则搜索成功。
我必须改变什么来完成这个?我花了 3 天时间搜索,一无所获。
【问题讨论】:
-
当您在地址栏中输入 blog20.html?s=#Benjamin 时,这意味着什么都不搜索 (s=) 并转到 Benjamin id (#Benjamin)。
-
你总是可以使用 JS 来做这件事,但这不值得。您应该在 url 字符串中使用
#*(Hash) *