SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member tntmom5's Avatar
    Join Date
    Jul 2001
    Location
    New Jersey
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript pop-behind error

    I use this pop-up once script, and I modified it to pop-behind once. I am getting this error: line 112 Char 1 Object expected. This is the // End --> line.

    See the page at http://tntmom.com

    <SCRIPT LANGUAGE="JavaScript" type="text/javascript">

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    var expDays = 365; // number of days the cookie should last

    var page = "http://personalizedpartyfavor.com/submom3.htm?who=tntmom"
    var window props = "width=515,height=400,location=no,tool bar=no,menu bar=no,scroll bars=no,re sizable=no,left=85,top=20";

    function MakeBottomWindow() {
    var botwin = window.open(page, "bw", windowprops);
    self.focus();
    }

    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); = 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));
    // cookie expires in one year (actually, 365 days)
    // expDays=365 days (one year)
    // 24 hours in a day
    // 60 minutes in an hour
    // 60 seconds in a minute
    // 1000 milliseconds in a second

    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);

    MakeBottomWindow();
    }
    else {
    count++;
    SetCookie('count', count, exp);
    }
    }
    // End -->
    </script>

    </head>
    <body bgcolor="#ffffff" OnLoad="checkCount()">

    Any help would be appreciated greatly.
    God Bless,
    Tracy Gibson
    http://www.tntmom.com
    http://www.tntgibson.com

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found one error, think it could be the problem.

    change this: The ; is the problem
    function DeleteCookie (name) {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    var cval = GetCookie (name);
    document.cookie = name + "=" + cval + ";
    expires=" + exp.toGMTString();
    }

    To This:

    function DeleteCookie (name) {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1);
    var cval = GetCookie (name);
    document.cookie = name + "=" + cval
    + "expires=" + exp.toGMTString();
    }

  3. #3
    SitePoint Member tntmom5's Avatar
    Join Date
    Jul 2001
    Location
    New Jersey
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Thank You, Thank You!

    Fly Swatter,

    Thank you. I have been posted this problem all over the net and you are the one who solved it.

    No more error and the script works.

    Thanks again.
    God Bless,
    Tracy Gibson
    http://www.tntmom.com
    http://www.tntgibson.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No prob, I enjoy squashing bugs


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
  •