Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Dynamiczne dodawanie dni
Randallmaster
post
Post #1





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

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


Witam serdecznie,

Muszę stworzyć przyciski dodające +7, +14,+21 dni

format daty: 00-00-000

  1. $data = date('d-m-Y');


W jaki sposób można to zrobić?
Go to the top of the page
+Quote Post
kamil4u
post
Post #2





Grupa: Zarejestrowani
Postów: 2 350
Pomógł: 512
Dołączył: 4.01.2009
Skąd: Wrocław / Świdnica

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


Pisane na szybko:
[JAVASCRIPT] pobierz, plaintext
  1. <script>
  2. var date;
  3. var dDate;
  4.  
  5. date = new Date();
  6. dDate = date.getDate() +'.'+ (parseInt(date.getMonth())+1) +'.'+ date.getFullYear();
  7. alert( dDate );
  8.  
  9. date.setDate( date.getDate()+7 );
  10. dDate = date.getDate() +'.'+ (parseInt(date.getMonth())+1) +'.'+ date.getFullYear();
  11. alert( dDate );
  12.  
  13. date.setDate( date.getDate()+7 );
  14. dDate = date.getDate() +'.'+ (parseInt(date.getMonth())+1) +'.'+ date.getFullYear();
  15. alert( dDate );
  16.  
  17. date.setDate( date.getDate()+7 );
  18. dDate = date.getDate() +'.'+ (parseInt(date.getMonth())+1) +'.'+ date.getFullYear();
  19. alert( dDate );
  20. </script>
[JAVASCRIPT] pobierz, plaintext


Ten post edytował kamil4u 12.01.2013, 13:47:54
Go to the top of the page
+Quote Post
Randallmaster
post
Post #3





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

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


Witam,

Czemu nie działa:

http://jsfiddle.net/tES4F/

Go to the top of the page
+Quote Post
sowiq
post
Post #4





Grupa: Zarejestrowani
Postów: 1 890
Pomógł: 339
Dołączył: 14.12.2006
Skąd: Warszawa

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


A co to jest za kwiatek?

[JAVASCRIPT] pobierz, plaintext
  1. $(function() {
  2. <script>
  3. var date = $('#data');
[JAVASCRIPT] pobierz, plaintext


Usuń ten '<script>'.
Go to the top of the page
+Quote Post
Randallmaster
post
Post #5





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

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


Czemu nie pobiera danej var date = $('#data');

http://jsfiddle.net/tES4F/1/

Ten post edytował Randallmaster 16.01.2013, 09:02:21
Go to the top of the page
+Quote Post
Sephirus
post
Post #6





Grupa: Zarejestrowani
Postów: 1 527
Pomógł: 438
Dołączył: 28.06.2011
Skąd: Warszawa

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


Edit: Zerknij na to

Ten post edytował Sephirus 16.01.2013, 09:43:44
Go to the top of the page
+Quote Post
Randallmaster
post
Post #7





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

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


(IMG:style_emoticons/default/smile.gif) SUper Dziękuję (IMG:style_emoticons/default/wink.gif)
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: 23.08.2025 - 16:33