What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » JS help

JS help
Author: Message:
Supersonicdarky
Veteran Member
*****

Avatar

Posts: 2317
Reputation: 48
– / – / Flag
Joined: Feb 2005
Status: Away
O.P. JS help
I need a js that will automaticly close a window after a certain amount of time!

i already tried fowarding to the close window js, but didn't work

help? :huh:
10-13-2005 06:26 PM
Profile E-Mail PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
20 / Other / Flag
Joined: Jul 2003
RE: JS help
code:
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{
    // Set the length of the timer, in seconds
    secs = 10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        alert("You have just wasted 10 seconds of your life.")
window.close
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}
//-->
</SCRIPT>


then

code:
<body onLoad="InitializeTimer()">

http://www.mcfedries.com/JavaScript/timer.asp

just a edited version of some code i found :)

This post was edited on 10-13-2005 at 06:32 PM by Stigmata.
10-13-2005 06:31 PM
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: JS help
ok.

stig your code wont work.

your callling
window.close .... thats a link to the function varible you need to add a () after it like
window.close();

next that code is way too long for such a simple task!
time is in millisec.
code:
window.setTimeout(function(e){window.close( ); } , 1000 );


This post was edited on 10-13-2005 at 06:45 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
10-13-2005 06:45 PM
Profile PM Web Find Quote Report
Supersonicdarky
Veteran Member
*****

Avatar

Posts: 2317
Reputation: 48
– / – / Flag
Joined: Feb 2005
Status: Away
O.P. RE: JS help
but in IE it asks you "The page you are viewing is trying to close the window. Do you want to close this windows now?"

anyway to bypass it?


and it doesn't work in firefox :(
10-13-2005 07:15 PM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: JS help
quote:
Originally posted by Supersonicdarky
but in IE it asks you "The page you are viewing is trying to close the window. Do you want to close this windows now?"

anyway to bypass it?


and it doesn't work in firefox [Image: msn_sad.gif]
[Image: xso_undecided.gif] odd i closed my tab with it.

and no unless you own that window then you cant stop it asking you.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
10-13-2005 07:17 PM
Profile PM Web Find Quote Report
Supersonicdarky
Veteran Member
*****

Avatar

Posts: 2317
Reputation: 48
– / – / Flag
Joined: Feb 2005
Status: Away
O.P. RE: JS help
what do you mean by own?
10-13-2005 07:21 PM
Profile E-Mail PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
34 / Male / –
Joined: Jun 2004
RE: JS help
quote:
Originally posted by Supersonicdarky
what do you mean by own?

If you create that window (open it from one of your pages) then you own it
10-13-2005 07:24 PM
Profile PM Find Quote Report
Supersonicdarky
Veteran Member
*****

Avatar

Posts: 2317
Reputation: 48
– / – / Flag
Joined: Feb 2005
Status: Away
O.P. RE: JS help
what if it's like the shoutbox, is it pwnable? :P
beacuse i'm trying to make a windows like that close

i can't explain exactly what i mean :(

examle:

i click the link with the onclick="NewWindow(this.href,'name','547','354','yes');return false" code in it, is it possible to automaticly close that?

This post was edited on 10-13-2005 at 07:29 PM by Supersonicdarky.
10-13-2005 07:27 PM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: JS help
quote:
Originally posted by Supersonicdarky
what if it's like the shoutbox, is it pwnable? [Image: msn_tongue.gif]
beacuse i'm trying to make a windows like that close

i can't explain exactly what i mean [Image: msn_sad.gif]
yes it is.


errr in the main content you have to save the window in a varible (what window.opens returns)

then set a timeout with that varible and do varWindow.close(); 


http://developer.mozilla.org/en/docs/DOM:window.open
http://developer.mozilla.org/en/docs/DOM:window.close

This post was edited on 10-13-2005 at 07:35 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
10-13-2005 07:29 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On