Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] Jak to zrobic zeby wyswietlało raz na 24H
bambolo
post
Post #1





Grupa: Zarejestrowani
Postów: 135
Pomógł: 0
Dołączył: 10.02.2007

Ostrzeżenie: (10%)
X----


Witam dobrzy ludzie powiedzcie jak mam za pomocą cookie (chyba najlepiej) zrobic zeby oto ten skrypt wywalał mi okienko raz na 24h (IMG:style_emoticons/default/sad.gif) a nie tak jak jest teraz co odswierzanie strony mi go ładuje (IMG:style_emoticons/default/sad.gif)

  1.  
  2. <link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
  3.  
  4. <script type="text/javascript" src="windowfiles/dhtmlwindow.js">
  5.  
  6. /***********************************************
  7.  
  8. * DHTML Window Widget- Š Dynamic Drive (www.dynamicdrive.com)
  9.  
  10. * This notice must stay intact for legal use.
  11.  
  12. * Visit <a href="http://www.dynamicdrive.com/" target="_blank">http://www.dynamicdrive.com/</a> for full source code
  13.  
  14. ***********************************************/
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. <link rel="stylesheet" href="modalfiles/modal.css" type="text/css" />
  22.  
  23. <script type="text/javascript" src="modalfiles/modal.js"></script>
  24.  
  25. </head>
  26.  
  27.  
  28. <!-##################### 1) DHTML Modal Window Example 1: ###################-->
  29.  
  30. <script type="text/javascript">
  31.  
  32.  
  33. var agreewin=dhtmlmodal.open("agreebox", "iframe","/zakaz.gif", "This image has been marked as adult content. You must be 18 years of age or older to proceed.", "width=300px,height=300px,center=1,resize=1,scrolling=0", "recal")
  34.  
  35.  
  36.  
  37. agreewin.onclose=function(){ //Define custom code to run when window is closed
  38.  
  39. var theform=this.contentDoc.getElementById("eula") //Access form with id="eula" inside iframe
  40.  
  41. var yesbox=theform.eulabox[0] //Access the first radio button within form
  42.  
  43. var nobox=theform.eulabox[1] //Access the second radio button within form
  44.  
  45. if (yesbox.checked==true)
  46.  
  47. alert("You agreed to the terms")
  48.  
  49. else if (nobox.checked==true)
  50.  
  51. alert("You didn't agree to the terms")
  52.  
  53. return true //Allow closing of window in both cases
  54.  
  55. }
  56.  
  57.  
  58.  
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
MateuszS
post
Post #2





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


na poczatku (!), na samym poczatku kodu w 1 linijcie <? ob_start(); ?> i w ostatniej <? ob_end flush(); ?>

i teraz

  1. if(!isset($_COOKIE['ciacho'])) {
  2. //tutaj ten skrypt twoj i pod spodem:
  3.  
  4. setcookie('ciacho','1',time()+3600*24);
  5. }


Go to the top of the page
+Quote Post
bambolo
post
Post #3





Grupa: Zarejestrowani
Postów: 135
Pomógł: 0
Dołączył: 10.02.2007

Ostrzeżenie: (10%)
X----


Baardzo bym Cie prosił jak to ma dokładnie wyglądac bo mi jakies błędy wywala (IMG:style_emoticons/default/sad.gif) pliiss przylep to tu (IMG:style_emoticons/default/smile.gif)
i cos nie dziala (IMG:style_emoticons/default/sad.gif) mimo ze wyczysciłem ciacha teraz wogule nie pojawia sie okienko

Ten post edytował bambolo 17.10.2009, 18:27:09
Go to the top of the page
+Quote Post
MateuszS
post
Post #4





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


  1. <? ob_start(); ?>
  2. <html>
  3. <head>
  4.  
  5. <link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
  6.  
  7. <script type="text/javascript" src="windowfiles/dhtmlwindow.js">
  8.  
  9. /***********************************************
  10.  
  11. * DHTML Window Widget- ? Dynamic Drive (www.dynamicdrive.com)
  12.  
  13. * This notice must stay intact for legal use.
  14.  
  15. * Visit http://www.dynamicdrive.com/ for full source code
  16.  
  17. ***********************************************/
  18.  
  19.  
  20.  
  21. </script>
  22.  
  23.  
  24.  
  25. <link rel="stylesheet" href="modalfiles/modal.css" type="text/css" />
  26.  
  27. <script type="text/javascript" src="modalfiles/modal.js"></script>
  28.  
  29. </head>
  30.  
  31. <body>
  32.  
  33. <!-##################### 1) DHTML Modal Window Example 1: ###################-->
  34.  
  35. <? if(!isset($_COOKIE['ciacho'])) { ?>
  36. <script type="text/javascript">
  37.  
  38.  
  39. var agreewin=dhtmlmodal.open("agreebox", "iframe","/zakaz.gif", "This image has been marked as adult content. You must be 18 years of age or older to proceed.", "width=300px,height=300px,center=1,resize=1,scrolling=0", "recal")
  40.  
  41.  
  42.  
  43. agreewin.onclose=function(){ //Define custom code to run when window is closed
  44.  
  45. var theform=this.contentDoc.getElementById("eula") //Access form with id="eula" inside iframe
  46.  
  47. var yesbox=theform.eulabox[0] //Access the first radio button within form
  48.  
  49. var nobox=theform.eulabox[1] //Access the second radio button within form
  50.  
  51. if (yesbox.checked==true)
  52.  
  53. alert("You agreed to the terms")
  54.  
  55. else if (nobox.checked==true)
  56.  
  57. alert("You didn't agree to the terms")
  58.  
  59. return true //Allow closing of window in both cases
  60.  
  61. }
  62.  
  63.  
  64. </script>
  65.  
  66. <?
  67. setcookie('ciacho','1',time()+3600*24);
  68. } ?>
  69. </body>
  70. </html>
  71. <? ob_end_flush(); ?>



i pisz jakie bledy ci wywala

Ten post edytował MateuszScirka 17.10.2009, 18:26:23
Go to the top of the page
+Quote Post
bambolo
post
Post #5





Grupa: Zarejestrowani
Postów: 135
Pomógł: 0
Dołączył: 10.02.2007

Ostrzeżenie: (10%)
X----


działa działa (IMG:style_emoticons/default/smile.gif) the a jak teraz bym chciał na 6-12 lub 24h to tylko zmienie to
  1. setcookie('ciacho','1',time()+3600*24);
  2. setcookie('ciacho','1',time()+3600*12);
  3. setcookie('ciacho','1',time()+3600*6);


Dobrze gadam ?

Ten post edytował bambolo 17.10.2009, 19:10:01
Go to the top of the page
+Quote Post
MateuszS
post
Post #6





Grupa: Zarejestrowani
Postów: 1 429
Pomógł: 195
Dołączył: 6.10.2008
Skąd: Kraków/Tomaszów Lubelski

Ostrzeżenie: (0%)
-----


tak w ogole to co ty chcesz ukryc? ktory kod? ten w head czy ten w body?
Go to the top of the page
+Quote Post
bambolo
post
Post #7





Grupa: Zarejestrowani
Postów: 135
Pomógł: 0
Dołączył: 10.02.2007

Ostrzeżenie: (10%)
X----


Juz wszystko dział (IMG:style_emoticons/default/smile.gif) thx
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 18:14