views:

155

answers:

2

Check this http://javascript.internet.com/forms/multiple-search-engine.html page. I wonder how to open search result in new window which works for Internet Explorer. Also, how to set body onload for the searchbox. Please help me. This third times i asked but there's no expert able to solve this. Before this, an expert was sent a solution but it works just for mozilla only. Help me. TQ.

+1  A: 

I haven't delved into your code deeply, but try changing

<form name="searchForm">

into

<form name="searchForm" target="_blank">

that should open it in a new window.

Pekka
still not works.. :(
Heypy.com
Can you show a live example?
Pekka
this is http://javascript.internet.com/forms/multiple-search-engine.html live example.
Heypy.com
@Heypy that is the variant that doesn't do what you want, isn't it? Can you show an example of your approach?
Pekka
i've got the solution.but i did not want to open in new customized window coz it has problem with pop-up blocker. its there any alternative way?
Heypy.com
@Heypy probably not without extensively rewriting the Javascript.
Pekka
i've tried it but both browsers not works for it. please help me. i prefer open result in new tab.
Heypy.com
@Heypy It's not possible to force the browser to open it in a new tab. `_blank` will open it in a new window or a new tab, depending on the user's settings.
Pekka
ok, i agree..but still not works for IE..help me out!
Heypy.com
+3  A: 

It seems that in your case the form submits into a new tab instead a new window. The new window can be forced by setting the width and height of the new window, but you must be aware that popup blockers can prevent this action. Also don't forget to set the target attribute to _blank in the form so you can degrade gracefully in browsers with js deactivated.

<script type="text/javascript">
// frm is a reference to the FORM element
function frm_sbmit(frm) {
    wnd = window.open("about:blank", "_blank", "width=1024px, height=768px, + put here everithing you want in options for the new window, a good guide is http://www.w3schools.com/jsref/met_win_open.asp");
    frm.target = wnd;
    frm.submit();
}
</script>
<form action="url" target="_blank" method="post" onsubmit="frm_sbmit(this);return false;">
...
</form>
Rodrigo
+1, that looks like the way to go.
Pekka
then how to open search result in new tab?
Heypy.com