tags:

views:

24

answers:

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

I want to reserve the original window ,how to do it in javascript?

+3  A: 
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type)
Thilo
+1  A: 
window.open("/search.php?key=" + encodeURIComponent(key) + "&type=" + type);
Chinmayee
+1  A: 

You use the window.open method, and specify _blank as target:

var url = '/search.php?key=' + encodeURIComponent(key) + '&type=' + type;
window.open(url, '_blank');
Guffa