views:

100

answers:

2

see this http://javascript.internet.com/forms/multiple-search-engine.html . i wonder how to open the search result in new window. help me!

+3  A: 

1) Don't do that

2) Really don't do that

3) In the case that you have to do that, bind a function to the onclick event of the "search" button. Inside the function, use window.open to pop up a new window with the address you want to send the user to. Depending on how the user configured his browser, the browser may instead open another tab. At the end of the function, return false.


OK actually there's no need to write any other code because the form is already JS-driven. In the source of that page you linked to, find the following line:

location.href = finalSearchString;

Substitute it with the following line:

window.open(finalSearchString, 'Search results');

That's it. The button will pop up another page or tab.

WARNING

That page is somewhat outdated and some of the search engines don't work properly (the link generated is wrong).

Kaze no Koe
Kaze, please SHOW the example to me and to people. TQ.
Heypy.com
My explanation requires only basic JS skills, if you want me to post working code then please add the relevant HTML fragment to your question and specify if you're using a particular JS framework.
Kaze no Koe
please3.... stackoverflow has so much JS experts here.. check out this: http://javascript.internet.com/forms/multiple-search-engine.html THEN give a relevan answer how to open the search result in new window. I mean, please send the complete source code to my email address: info @ heypy.com . You help me, i'll advertise your website in my website for 1 year. TQ.
Heypy.com
Done, don't worry about linking to my site.
Kaze no Koe
it not works with IE
Heypy.com
A: 

but it not works in IE

Heypy.com