Hi,
Gabriella wrote:
Thanks a lot!!
Another question:
I want to refresh the opener page immediately after closing the popup.
How do I do that?
If you keep the popup, before you close the pop-up with self.close(),
you can call
opener.location.reload();
"opener" is a keyword with a reference to the opener window. The Window
object has a location property, which is an instance of the Location
object, which you can reload.
Why are popups not recommended?
For many reasons, mostly explained here:
http://developer.mozilla.org/en/docs...dow.open.28.29
In short: You can never be sure that a popup will actually be displayed
(because of popup blockers), and it annoys users.
For the record, I still have a few apps using popups, but I am slowly
removing them when I work on these apps.
Can you show me how to use an inline floading DIV instead?
You can use this kind of HTML/CSS code to position a DIV absolutely:
<div style="position: absolute;
top: 100px;
left: 200px;">
....
</div>
Additionally, you can play with the "display" property in the style to
show and hide the DIV, for example:
<div id="divForm"
style="position: absolute;
top: 100px;
left: 200px;
display: none;">
....
</div>
and then:
var nDiv = document.getElementById( "divForm" );
if ( nDiv
&& nDiv.style
&& nDiv.style.display )
{
nDiv.style.display = "block";
}
Note that since the DIV is inline (not a separate window), when you
submit the form, the whole page will be refreshed, which is what you
wanted from the start.
If you want to avoid refreshing the page, then you must resort to AJAX
to post your data to the server.
Thanks again, Gabi.
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering:
http://www.galasoft-LB.ch
PhotoAlbum:
http://www.galasoft-LB.ch/pictures
Support children in Calcutta:
http://www.calcutta-espoir.ch