Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript]Dynamiczne dodawanie dni
Forum PHP.pl > Forum > Przedszkole
Randallmaster
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ć?
kamil4u
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
Randallmaster
Witam,

Czemu nie działa:

http://jsfiddle.net/tES4F/

sowiq
A co to jest za kwiatek?

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


Usuń ten '<script>'.
Randallmaster
Czemu nie pobiera danej var date = $('#data');

http://jsfiddle.net/tES4F/1/
Sephirus
Edit: Zerknij na to
Randallmaster
smile.gif SUper Dziękuję wink.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.