SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, i have this external javascript. Basically i only want it to be loaded if the visitor has not seen it in the previous week.

    My aim was to use a javascript cookie setter to see a cookie when the external javascript is first loaded and then check each time to see how long the visitor has not seen if for before it is loaded again.

    Ok, how do i include an external javascript inside an internal javascript.

    Otherwise, how could i do this using php? the pages are all php pages so that would be just fine. Is there some cookie setting code in php that could do the check and then the results send the javascript. I am new to php so any actual cookie code that would do this would be greatly appreciated.

    Thanks.

  2. #2
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    document.write("whatever tag you use to include the external script");

    Try that
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  3. #3
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You can't do that.

    You have to include the javascript all the time and then if the specifications you want are met then call a function that starts the whole thing in the included javascript.
    Wayne Luke
    ------------


  4. #4
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i say include i have been using this:

    (it is advertising banner)


    <SCRIPT LANGUAGE="JavaScript" src="http://www.popuptraffic.com/assign.php?l=ascifi"></script>

    does that work with your method wluke?

  5. #5
    SitePoint Zealot freejavahelp's Avatar
    Join Date
    Jul 2000
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k, my bad

    sorry bout that, thought it might work
    http://www.freejavahelp.com
    Making Java REALLY Easy
    Tutorials, Forums, and Articles

  6. #6
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok i did it in php like this:

    <?php
    $check = "test";
    $check .= $filename;
    if ($test == $check)
    {
    print("<HTML><BODY>
    not back yet!

    </BODY></HTML>");
    }
    else
    {
    $rated = "test";
    $rated .= $filename;
    setcookie(test, $rated, time()+86400);
    print("<HTML><BODY><SCRIPT LANGUAGE=JavaScript src=http://www.popuptraffic.com/assign.php?l=ascifi></script>
    well you have been away for a bit!</BODY></HTML>");
    }
    ?>

    seems to work..

    any comments on it?

  7. #7
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That will work because the HTML is not processed until the javascript is inserted or not.
    Wayne Luke
    ------------



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
  •