Advertisement

10.02.2008 at 10:41AM PDT, ID: 23782496
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.3

onLoad JavaScript timed popup module

Asked by iPromoExpert in JavaScript

Tags: , ,

Hello Experts,

I have been working on a JavaScript solution for my website. The task is to get a hidden div to "pop up" in the middle of a users screen based on a set of timers. for testing purposes the timers in the code below have been set to 2 seconds and 10 seconds. So user comes to our site, 2 seconds after the page loads a floating div popup comes up asking if they need help and giving them the option to enter their info and question and submit the form, or click on a livechat button and connect directly with a live chat representative. If the user closes the popup, another one should come up lets say 2 minutes later (in the code its 10 seconds to save time on testing). there will also be a check box that allows the user to completely disable this popup in the future (something like do not show this window again). I've got all of this to work, however i ran into a problem, every time the user changes pages the longer timer resets its self so if a user has not spent 2 minutes on one page he will never see the 2nd popup. My question is, is there any way to keep track of how long the users has been on the SITE and use that for a timer for the 2nd popup. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
function TimedPop() {
	var cookie = readCookie('RAQviewed');
	if (cookie != 3){
		if (cookie == 2){
			var delay = 10; // time in seconds before popup opens
			timer = setTimeout("showRAQ('floatlayer')", delay*1000);
		}
		if (cookie == 1 || cookie == null || cookie == ''){
			createCookie('RAQviewed', 2, 30);
			var delay = 2; // time in seconds before popup opens
			timer = setTimeout("showRAQ('floatlayer')", delay*1000);
		}
	}
}
function showRAQ(divid){
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
	if ($(divid).style.display != "block")
	{
		if(isIE){
			$(divid).style.left = (document.body.clientWidth - 400)+"px";
			$(divid).style.top = (document.body.scrollTop)+"px";
		}
		else {
			$(divid).style.left = (document.documentElement.clientWidth - 400)+"px";
			$(divid).style.top = (document.body.scrollTop)+"px";
		}
		$(divid).style.display = "block";
		var mydrag = new Draggable(divid, {scroll: window});
		new Effect.Move(divid, { x: -400, y: 250, mode: 'relative' });
	}
}
function createCookie(name, value, days)
{
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
	    if (c.indexOf(nameEQ) == 0){
	    	return c.substring(nameEQ.length, c.length);
	    }
    }
  return null;
}
 
function eraseCookie(name){createCookie(name, "", -1);}
[+][-]10.02.2008 at 03:28PM PDT, ID: 22629379

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: JavaScript, IE6+, FF2+, onLoad event, Timed popup, javascript session time.
Sign Up Now!
Solution Provided By: scrathcyboy
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628