gpt4 book ai didi

javascript - 链接重定向到错误页面

转载 作者:行者123 更新时间:2023-11-28 17:28:38 25 4
gpt4 key购买 nike

这是我的 Blog

我在首页添加了多标签搜索。

但是当我从菜单中选择绿色和灰色标签并单击过滤器后,它会重定向到 example.com/search/?q=label:blue|label:black页

但想将绿色和灰色标签重定向到 label:green|label:gray

下面是代码

<!doctype html>


<div class="tabs-outer">
<div class="tabs-cap-top cap-top">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
<div class="fauxborder-left tabs-fauxborder-left">
<div class="fauxborder-right tabs-fauxborder-right"></div>
<div class="region-inner tabs-inner">
<div class="tabs section" id="main">
<div class="widget HTML" id="HTML3">
<h2 class="title">Multi Label Search</h2>
<div class="widget-content">
<div id="multi-search">
<select id="cmbColumn" name="cmbColumn">
<option value="" />Columns
<option value="green+" />green
<option value="blue+" />blue
</select>
<select id="cmbSidebar" name="cmbSidebar">
<option value="" />Sidebars
<option value="Gray+" />Gray
<option value="black+" />black

</select>

<input onclick=" getValue() " value="Filter" type="button" />
</div>
</div>
<div class="clear"></div>
<span class="widget-item-control">
<span class="item-control blog-admin">
<a class="quickedit" href="https://www.blogger.com/rearrange?blogID=5988384389032442595&action=editWidget&sectionId=main" onclick=" return _WidgetManager._PopupConfig(document.getElementById(&quot;HTML3&quot;)); " target="configHTML3" title="Edit">
<img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18" />
</a>
</span>
</span>
<div class="clear"></div>
</div>
</div>
<div class="tabs section" id="main"></div>
</div>
</div>
<div class="tabs-cap-bottom cap-bottom">
<div class="cap-left"></div>
<div class="cap-right"></div>
</div>
</div>
<script type="text/javascript">
function getValue() {
var
valcmbColumn = document.getElementById("cmbColumn").value = "green";
valcmbSidebar = document.getElementById("cmbSidebar").value = "|label:Gray";

valOutput = (valcmbColumn + valcmbSidebar);
window.open("/search/?q=label:" + valOutput, "_self");

valcmbColumn = document.getElementById("cmbColumn").value = "blue";
valcmbSidebar = document.getElementById("cmbSidebar").value = "|label:black";

valOutput = (valcmbColumn + valcmbSidebar);
window.open("/search/?q=label:" + valOutput, "_self");


}




function toggle_visibility(id) {
var e = document.getElementById(id);
if (e.style.display == "block") {
e.style.display = "none";
} else {
e.style.display = "block";
}
}
</script>


</!doctype>

最佳答案

试试这个。我认为这应该可以解决问题。我无法使用您提供的代码对其进行测试

   function getValue() {
var valcmbColumn = document.getElementById("cmbColumn").value;
var valcmbSidebar = document.getElementById("cmbSidebar").value;

valOutput = "label:"+valcmbColumn+"|label:"+ valcmbSidebar;
window.open("/search/?q=" + valOutput, "_self");
}

告诉我它是否有效

关于javascript - 链接重定向到错误页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38082760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com