[SPAM] - Re: [Javascript] window.close not working - Email foundin subject

Matt Barton javascript at mattbarton.org
Mon Dec 6 03:31:30 CST 2004


You could try this:

Change your test.js library so that all of the pertinant parts (the db 
write) are in a function.  fWriteToDB() for instance.  Then in your 
second window do something like this:

<!-- ************************ -->
<script language="javascript" src="test.js"></script>
<script languge="javascript">
	
	function fWriteAndClose () {
		// call the dbwrite function in test.js
		fWriteToDB ();

		// close the window
		self.close ();
	}

	window.setTimeout (fWriteAndClose() , 2000);
</script>
<!-- ************************ -->

Note: this is all untested, and I don't really agree with using 
javascript like this, but if this is how you really want to go then you 
could try it.

Matt



Jessica wrote:
> Hi,
> 
> I only want my window to close after I execute the following script.
> <script type="text/javascript" src="https://test.js"></script>      
> 
> It does not seem to work, I did change setTimeout 2 5 secs but still
> does not execute my test.js.
> 
> 
>  
> jess 
> 
>  
> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Kim Hoogenberg
> Sent: 06 December 2004 09:17
> To: [JavaScript List]
> Subject: [SPAM] - Re: [Javascript] window.close not working - Email
> found in subject
> 
> Hello,
> 
> setTimeout takes msec as second argument. Putting 5,000,000,000,000 
> msecs there will take you about appr. 58000 days to let the script be 
> executed. First try using some other number like 5 seconds (5000 msecs).
> 
> Hope this helps,
> 
> Kim
> 
> 
>> 
>>
>>Hi,
>>
>> 
>>
>>I have 2 windows, on button click of my 1rst window, I call the 2^nd 
>> window, which basically tracks button click & executes
>>
>>A script to write to the database.
>>
>>In the 2nd window I am calling a js file, which writes data to the db.
>>
>>This works fine but I only want the window which calls the script 2 be
> 
> 
>>opened for a few seconds.
>>
>>So after the script I have a window.close(). It does not write to the 
>>database with the window.close.
>>
>>So I put a setimeout() on my second window but it still does not write
> 
> 
>>2 the database. If I remove the window and manually close the window 
>>it writes.
>>
>> 
>>
>>*Window1*
>>
>>function srcLd()
>>
>>{ 
>>
> 
> window.open("ButtonClick.aspx","","width=1,height=1,top=700,scrollbars=0
> ,menubar=0,toolbar=0,location=0,status=0");
> 
>> }
>>
>> 
>>
>>*Window2 (This is all window2 has and I need it open for a few 
>>seconds, execute test.js which writes ordervalue to the db and then 
>>automatically close)*
>>
>> <form name="test">
>>
>>                        <input type="text" name="orderValue"
> 
> value="999" >
> 
>>            </form>
>>
>><script type="text/javascript" src="https://test.js"></script>      
>>
>> 
>>
>><script language="javascript">
>>
>>            
>>setTimeout(self.close(),5000000000000)
> 
> 
>></script>
>>
>> 
>>
>>Please assist.
>>
>>jess
>>
>> 
>>
>> 
>>
>>-----------------------------------------------------------------------
> 
> -
> 
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>> 
>>
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 



More information about the Javascript mailing list