如何在新窗口中执行此操作?

时间:2010-10-20 07:02:31

标签: javascript

location.href = "/search.php?key=" + encodeURIComponent(key) + "&type=" + type;

我想保留原始窗口,如何在javascript中完成?

3 个答案:

答案 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');