[thelist] Form which submits to a blank sized window

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Tue Mar 22 08:42:13 CST 2005


> and the JS:
>        function submit2win(o)
>                {
>                        foowin=window.open('','foowin','width=200,height=200,toolbars=no');
>                        o.target='foowin';
>                        o.submit();
>                        return false;
>                }
> In action:

>Would be a quick and dirty solution. However, that might fail when the
>window wasn't opened for some reason.

It can fail if the form submit before the window loads fully as well.
Here is a non quick but dirty fix :)

<script>
var o = null;
function submit2win() {
	o = myLovelyFormReference;//document.forms[whatever]

	foowin=window.open('blank.html','foowin','width=200,height=200,toolbars=no');

	if(foowin.loaded && foowin.loaded())  {
		o.target='foowin';
		o.submit();
		return false;
	}
	else {setTimeout("submit2Win()",500);}                       
}
</script>

***

and blank.html 
<script>
var g_blnWindowLoaded=false;
function loaded() {return g_blnWindowLoaded;}
window.onload = function() {g_blnWİndowLoaded = true;}
</script>

HTH
Cheers
Volkan.


More information about the thelist mailing list