Click to See Complete Forum and Search --> : window.setTimeout


davec
10-29-2003, 11:43 AM
hi i have a problem with my code. i have basically a main htm file which is set to load another htm file as a popup. i did want the window to close after 10 seconds but it wouldnt work. i have had it working on my pc but when i upload it to my webspace it will not work.

heres the code.


Main htm file

<script language="JavaScript">
setup='toolbar=no,location=no,directories=no,status=no,menubar=no,width=500,height=150'setup+= 'scrollbars=no,resizable=no,toolbar=no,'

window.open ("http://www.4xe.co.uk/dave.htm","pop",setup)
</script>


popup dave.htm source

<script language="JavaScript">
window.setTimeout("self.close()", 10000);
</script>


I have read a book about this but i really can't get my head arround it.

with the window.setTimeout i have changed the self.close to window.close and dave.close

Thanks

suganya
10-29-2003, 12:21 PM
try this:

setTimeout('self.close()',10000);

and make sure this is within the head of the html....

suganya

davec
10-29-2003, 12:26 PM
hi, i tried this but it didnt work :(

<HTML>
<HEAD>
<META NAME="Author" CONTENT="Dave">
<META NAME="Generator" CONTENT="safe">
<TITLE>Dave</TITLE>

<script language="JavaScript">
setTimeout('self.close()',10000);
</script>

</HEAD>


<BODY bgcolor="#000000" text="#FFFFFF">

</body>
</HTML>


thanks though :)

suganya
10-29-2003, 12:29 PM
I'm really sorry - I actually wanted to say outside the <head> </head> tags...

i have the same code right outside the </head> tag and it works...

<script language="JavaScript">
setTimeout('self.close()',10000);

that's what i have...

davec
10-29-2003, 12:42 PM
like this
<HTML>
<HEAD>
<META NAME="Author" CONTENT="Dave">
<META NAME="Generator" CONTENT="safe">
<TITLE>Dave</TITLE>


</HEAD>

<script language="JavaScript">
setTimeout('self.close()',10000);
</script>

<BODY bgcolor="#000000" text="#FFFFFF">



</body>
</HTML>

cos it didnt work :(

the site i am trying it on is www.stefc.co.uk

i have it set so that when th emain page is loaded it then opens the popup dave.htm located at www.4xe.co.uk/dave.htm

that has all the code in it.


cheers

suganya
10-29-2003, 12:48 PM
that's strange!....

bcos i tried going to that site and did a view source of the popup and saved it as a html file and ran it - it did prompt me saying that the browser is trying to close the page and if i want to.....

i cant think of anything else but the version of the browser....

what is the version u r running?...

davec
10-29-2003, 12:50 PM
i am running windows xp so it is i.e. 6 mate. i have the thing where it works offline when saved to the hard disk but not when uploaded?!?! very odd.

cheers