好的,所以这应该是一件相当容易的事情,但是我认为我遗漏了一些东西。我有一个像这样的输入字段。
<input id="jobSearchField" class="searchField" runat="server"
onkeypress="javascript:GoToFunc(event, this.value)" type="text"
onfocus="if (this.value == 'Seach jobs by JobID, JobTitle, Keywords, or Location') this.value=''"
value="Seach jobs by JobID, JobTitle, Keywords, or Location" />
我也有一个像这样的按钮。
<button id="filterSubmit" runat="server" class="filterSubmit">Submit</button>
这是我“尝试”构建的javascript。
<script type="text/javascript">
function GoToFunc(e, value) {
if (e.keyCode == 13) {
var location = document.location.href + "&query=" + value;
document.location.href = location;
document.open();
}
}
</script>
我“尝试”构建的 javascript 函数假设将该查询字符串传递回 url,以便我可以解析用户想要的内容。我使用 ASP.NET 和 C# 作为语言。
所以问题是我如何在 url 中作为参数返回用户输入的内容?