andz Posted November 7, 2007 Share Posted November 7, 2007 I need a code that will check the time the user spends on the webpage. and once the user is more than 1 minute, a new window will popup with the login form or if not registered form. Thanks Quote Link to comment Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 Place the following script between the <HEAD> and </HEAD> tags: <script language="javascript"> <!-- begin function TimedPop() { url = "URL/to/popup.html"; width = 320; // width of window in pixels height = 390; // height of window in pixels delay = 60; // time in seconds before popup opens timer = setTimeout("popup(url, width, height)", delay*1000); } // end --> </script> Add the following code into your <BODY> tag: onLoad="TimedPop()" Your <BODY> tag should then look something like this: <BODY onload="TimedPop()" bgcolor="#ffffff" text"#000000"> this was found in a matter of seconds using google search,http://www.nowsell.com/pop-ups/pop-up-scripts.html hope it helps Quote Link to comment Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 thanks for the help. i've got an error and no popup window appeared. Quote Link to comment Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 could you post some code and the error your being shown please =] also use tags makes life a little simpler Cheers Quote Link to comment Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 no error code is being produced. but no popup is happening. i tried even in mozilla firefox and nothing's happening. Quote Link to comment Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 i just tried this and it worked for me <script language="javascript"> <!-- begin function TimedPop() { url = "http://yoursite.co.uk/popup/wherever.html"; width = 320; // width of window in pixels height = 390; // height of window in pixels delay = 5; // time in seconds before popup opens timer = setTimeout("window.open(url, width, height)", delay*1000); } // end --> </script> </head> <BODY onload="TimedPop()" bgcolor="#ffffff" text"#000000"> some text or other </body> Quote Link to comment Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 is there a way that this script will only work if the user is not login? so if the user is already logged in, this script will not be activated, if the user is not login, the popup script will activate. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.