Witam,

Zakładam ten temat ponieważ moja wiedza na temat JS jest raczej mierna i nie moge sobie poradzic z moim problemem. W popupie wyswietla sie jednostka reklamowa tradedoubler chcialem dodac do niej obsluge cookies aby wyswietlac ja raz na sesje, ale nie potrafie tego zaimplementowac. Probowalem wielu sposobow - albo cookies nie dziala, albo popup sie nie wyswietla... Z gory dzieki za wszelka pomoc.


fadw.js - tutaj probowalem dodac obsluge cookies:
  1. var tmr;
  2. var t;
  3. var obj;
  4.  
  5.  
  6.  
  7. function sFa() {
  8. obj = gObj();
  9. sLft();
  10. shw(true);
  11. t = 0;
  12. sTmr();
  13. }
  14.  
  15. function hFa() {
  16. t = -100;
  17. sTmr();
  18. return false;
  19. }
  20.  
  21. function sTmr() {
  22. tmr = setInterval("fd()",20);
  23. }
  24.  
  25. function fd() {
  26. var amt = Math.abs(t+=10);
  27. if(amt == 0 || amt == 100) clearInterval(tmr);
  28. amt = (amt == 100)?99.999:amt;
  29.  
  30. obj.style.filter = "alpha(opacity:"+amt+")";
  31. obj.style.KHTMLOpacity = amt/100;
  32. obj.style.MozOpacity = amt/100;
  33. obj.style.opacity = amt/100;
  34.  
  35. if(amt == 0) shw(false);
  36. }
  37.  
  38. function sLft() {
  39. var w = 375; // set this to 1/2 the width of the faw div defined in the style sheet
  40. // there's not a reliable way to retrieve an element's width via javascript!!
  41.  
  42. var l = (document.body.innerWidth)? document.body.innerWidth / 2:document.body.offsetWidth / 2;
  43.  
  44. obj.style.left = (l - w)+"px";
  45. }
  46.  
  47. function gObj() {
  48. return document.getElementById("faw");
  49. }
  50.  
  51. function shw(b) {
  52. (b)? obj.className = 'show':obj.className = '';
  53. }
  54.  
  55.  




kod dodany do index.html
  1. <div id="faw">
  2. <div class="bar"><a href="#">&nbsp;</a><span onClick="hFa()" class="close">&nbsp;</span></div>
  3. <div class="ad">TUTAJ KOD REKLAMY</div>
  4. </div>