1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Rep Power

    cookies/display once javacode??


    I am a rookie at javascript and I was wondering if any java programmers can tell me how I would call a script once, and then the script wont be called again if the visitor visits the same page in 24 hours using javascript and cookies, I know this is possible but all i have found is giant javascripts, and ones that you have to put into your <head> tags etc.

    This is the script i would call as an example:

    <script type="text/javascript" src="http://www.yoursite.com/cgi-bin/test/ad_test.cgi"></script>

    Now i have found avery good java code that will call a script once every 24 hours:

    <!-- Begin Ad Display Once Pop Up Code -->
    <script language=JavaScript type=text/javascript>
    if(get_cookie('popup')==''){var popUpWindow=window.open("http://www.yoursite.com/cgi-bin/ads/advert.cgi?zone_id=4&mode=popup","popup","width=0,height=0");document.cookie="popup=yes";}
    function get_cookie(name){var search=name+"=";var returnvalue="";if(document.cookie.length>0){offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1){end=document.cookie.length;returnvalue=unescape(document.cookie.substring(offset,end));}}}return returnvalue;}
    <!-- End Ad Display Once Pop Up Code -->

    but unfortunetly its a popup code....is there any sugesstions out there?? I would really, really appreciate some help as i am a rookie at Javascript.

  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Outside US
    Rep Power
    You posted in the wrong forum, there is an html/javascript one, this is for java which has nothing in common with javascript but the name (by Netscape Marketing Dept. I believe).

IMN logo majestic logo threadwatch logo seochat tools logo