tags:

views:

47

answers:

4

This is probably a simple question but I cannot figure out how to open the results from my database in a javascript popup window. I have an index.php page with a input box and an input button. When the user selects a date and presses the button, I'd like the results to open in a new window. How can I do this?

Thanks

A: 

This can be done with simple html:

<a href="some.htm" target="_new">Link Text</a>
craftsman
Thanks Umar. I know I can use target for a link but what about a input button? There is no target attribute for this. Do you have any ideas? Thanks.
Targets must start with a letter unless they are one of a short list of reserved names that begin with an underscore … and don't include _new. http://www.w3.org/TR/html4/types.html#h-6.16
David Dorward
A: 

You need to open your new window using window.open. What you could do, is pass the date in as a querystring parameter to the URL that makes up the popup window page, and then use that parameter to perform the lookup from the database.

This page shows how to use window.open.

Pete OHanlon
Thank you Pete. I will have a look there now.
+2  A: 

I strongly suggest not doing this — http://diveintoaccessibility.org/day_16_not_opening_new_windows.html — but if you insist, then:

<form action="…" target="_blank">
David Dorward
it looks better
craftsman
A: 

Use window.open to open another window. And than use this window to document.body.innerHTML your data.example

var wnd=window.open('','newWnd'); 
wnd.document.body.innerHTML="test"
Eldar Djafarov