0
window.open(str);   

这将/FindJobs.aspx?k=keyword&l=location在 url 栏中返回。

window.location.href = str;    

这将/FindJobs.aspx在 url 栏中返回。

两者都使用相同的脚本和相同的值。

window.loaction.href 显示参数的唯一方法是当我使用 firebug 单步执行脚本时。

我需要在同时使用 window.open 和 window.location.href 时显示参数

请帮忙,g5

对于它的价值,所有脚本都以正确的顺序加载,并添加到我之前页面的底部。我正在与之合作的团队要求我们这样做。

<div class="span5">
  <input type="text" id="Keyword" name="keyword" placeholder="Keyword..." class="span12 inFieldLabel">
</div>
<div class="span4">
  <input type="text" id="Location" name="location" placeholder="Location..." class="span12 inFieldLabel">
 </div>

<div class="row-fluid">
 <a id="searchJobs_Button" href="/FindJobs" class="btn btn-success pull-right">Find Job »</a>
</div>  

$("#searchJobs_Button").click(function () {
    var str = "/FindJobs.aspx" +
    "?k=" + encodeURIComponent($("#Keyword").val()) +
    "&l=" + encodeURIComponent($("#Location").val());
    alert(str);
    window.location.href = str;
    window.open(str);
});
4

0 回答 0