Results 1 to 2 of 2

Thread: Popup Window Once

  1. #1
    Join Date
    Oct 2004
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Popup Window Once

    I'm having problems with making ths javascript work. Can anyone help me out? I have three other javascripts within the head section don't know if that makes a difference, but here is the main Popup Window Once Cookie that I grabbed from SimplytheBest Site, Thanks in advance:


    <SCRIPT LANGUAGE="JavaScript">
    // Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
    <!-- Begin

    var expDays = 1; // number of days the cookie should last
    var page = "http://rosfslweb01/ITS/Surveys/Pop-Up/main.htm";
    var windowprops = "width=300,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";
    function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
    }
    return null;
    }
    function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
    }
    function DeleteCookie (name) {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    var cval = GetCookie (name);
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }
    var exp = new Date();
    exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
    function amt(){
    var count = GetCookie('count')
    if(count == null) {
    SetCookie('count','1')
    return 1
    }
    else {
    var newcount = parseInt(count) + 1;
    DeleteCookie('count')
    SetCookie('count',newcount,exp)
    return count
    }
    }
    function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
    }
    function checkCount() {
    var count = GetCookie('count');
    if (count == null) {
    count=1;
    SetCookie('count', count, exp);
    window.open(page, "", windowprops);
    }
    else {
    count++;
    SetCookie('count', count, exp);
    }
    }
    // End -->
    </script>


    <body onLoad= "checkCount()" bgcolor="#99CC99" link="#003565" vlink="#003565" alink="#003565" leftmargin="0" topmargin="0">

  2. #2
    Join Date
    Oct 2004
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Okay. This code works. It was conflicting with another script that another developer inserted into the page, a Translucent scroller script acquire from this site. I will post the new problem in another forum.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •