#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Derby UK
    Posts
    106
    Rep Power
    15

    Javascript and cookies


    Hi folks

    I've got a really cool script which gives a layered once-only message (err, it's not a poup, really!). The once-only property works with cookies, of course. But if someone has them disabled, it would reappear, repeatedly and annoyingly.

    Since the script has a delay feature, it seems to me that if I could combine two scripts - a cookie detection one, with the layered script one, I could specify 'if cookies disabled, set the time delay (var = ) to (say) 1 hour.' And get over the problem. Here's the two scripts:

    <SCRIPT LANGUAGE="JAVASCRIPT">
    <!--
    var tmpcookie = new Date();
    chkcookie = (tmpcookie.getTime() + '');
    document.cookie = "chkcookie=" + chkcookie + "; path=/";
    if (document.cookie.indexOf(chkcookie,0) < 0) {
    document.write("no cookies");
    } else {
    document.write("cookies");
    }
    //-->
    </SCRIPT>




    <link rel="stylesheet" href="slide.css" type="text/css">
    <script language="JavaScript">
    <!--
    var how_many_seconds = 10;
    var leftMargin = 160;
    var iniSlideMenuY=10;
    var slideTarget=15;
    var elementSliding=false;
    var days = 30;
    var smoothElement = 50;
    var bounceElement = 1;

    function resetnreload()
    {
    reset();
    location.href = window.location;
    }
    //-->
    </script>


    Do you thinkg this is possible? Thanks for any wisdom.
    Best wishes

    Tony
  2. #2
  3. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Aug 2003
    Location
    Toronto
    Posts
    1,614
    Rep Power
    17
    This you mean?
    Code:
    <SCRIPT LANGUAGE="JAVASCRIPT">
    <!--
    this.delay =0
    var tmpcookie = new Date();
    chkcookie = (tmpcookie.getTime() + '');
    document.cookie = "chkcookie=" + chkcookie + "; path=/";
    	if (document.cookie.indexOf(chkcookie,0) < 0) {
    	delay =60000; }
    }
    //-->
    </SCRIPT>
    webM

    for $i(0..20){for($j=0;$j<=$i;$j+=2){print pack(qq{H2},
    substr(qq{5f5745424d415354415f},$j,2));}print qq{\n};};
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    Derby UK
    Posts
    106
    Rep Power
    15

    thanks


    Thanks - I'm not sure! It seends something that will replace he line:

    var how_many_seconds = 3,


    in the script, and yet still be compatible with slide2.js!!

    I've tried with this, unsuccessully!

    Thanks

    Tony

IMN logo majestic logo threadwatch logo seochat tools logo