我有两个不同的页面。我想将查询字符串从一个发送到另一个。下面是我尝试过的示例代码
window.location.search = 'id='+hidposid.value;
window.location.href="editviewposition.aspx";
在另一个页面中我检索值
cookie1 = HttpContext.Current.Request.QueryString("id") ' returns ""
最佳答案
<script type="text/javascript">
$(function () {
$("#btnQueryString").bind("click", function () {
var url = "Page2.htm?name=" + encodeURIComponent($("#txtName").val()) + "&technology=" + encodeURIComponent($("#ddlTechnolgy").val());
window.location.href = url;
});
});
</script>
<input type="button" id="btnQueryString" value="Send" />
希望这对你有帮助..
关于javascript - 通过javascript将查询字符串从一个页面传递到另一个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23213499/