location.href = "/search.php?key=" + encodeURIComponent(key) + "&type=" + type;
我想保留原始窗口,如何在javascript中完成?
答案 0 :(得分:3)
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type)
答案 1 :(得分:1)
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type);
答案 2 :(得分:1)
您使用window.open
方法,并将_blank
指定为目标:
var url = '/search.php?key=' + encodeURIComponent(key) + '&type=' + type;
window.open(url, '_blank');