Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php/js/html]Data w textarea
kamil9091
post
Post #1





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 14.01.2007

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


  1. <head>
  2.  
  3. <script language="javascript">
  4. <!-- W3e JAVAScript Preset/Date
  5. var DDMMYY =0
  6. var MMDDYY =1
  7.  
  8. function getdate(mode)
  9. {
  10. var now = new Date();
  11. var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  12. if (mode==DDMMYY)
  13. var MonthDayYear =(dayNr+". "+(now.getMonth()+1)+". "+now.getYear());
  14. else
  15. var MonthDayYear =((now.getMonth()+1)+" . "+dayNr+" . "+now.getYear());
  16.  
  17. return MonthDayYear;
  18. }
  19.  
  20. function gettime()
  21. {
  22. var now = new Date();
  23. var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
  24. var hours = now.getHours();
  25. hours = ((hours > 12) ? hours - 12 : hours);
  26.  
  27. var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
  28. var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
  29. var TimeValue =(" " + hours + minutes + seconds + " " + ampm);
  30.  
  31. return TimeValue;
  32. }//-->
  33. </script>
  34.  
  35. </head>
  36.  
  37. <?php
  38.  
  39. $data = <script language=javascript>
  40. document.write(getdate(DDMMYY));
  41. </script>;
  42.  
  43. echo "<textarea>$data</textarea>"
  44. ?>


ok - wszystko pieknie wyglada - ale czemu w efekcie pole textarea jest puste ?


--------------------
Tutaj znajdowała się moja sygnatura, lecz niestety łamała ona regulamin i musiałem ją usunąć
teraz rozwijam swoje umiejętności graficzne i próbuję ją robić
aktualnie studiuję painta
nigdy nie myślałem, że on ma takie możliwości
Go to the top of the page
+Quote Post
Cysiaczek
post
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Jak dodasz apostrofy do:
  1. <?php
  2. $data = <script language=javascript>
  3. document.write(getdate(DDMMYY));
  4. </script>;
  5. ?>


To tak jakby pole textarea będzie wyglądało tak: klik

Nie wiem tylko, czy efekt Cię satysfakcjonuje tongue.gif

Pozdrawiam.


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
nospor
post
Post #3





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




  1.  
  2. <script language="javascript">
  3. <!-- W3e JAVAScript Preset/Date
  4. var DDMMYY =0
  5. var MMDDYY =1
  6.  
  7. function getdate(mode)
  8. {
  9. var now = new Date();
  10. var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
  11. if (mode==DDMMYY)
  12. var MonthDayYear =(dayNr+". "+(now.getMonth()+1)+". "+now.getYear());
  13. else
  14. var MonthDayYear =((now.getMonth()+1)+" . "+dayNr+" . "+now.getYear());
  15.  
  16. return MonthDayYear;
  17. }
  18.  
  19. function gettime()
  20. {
  21. var now = new Date();
  22. var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."
  23. var hours = now.getHours();
  24. hours = ((hours > 12) ? hours - 12 : hours);
  25.  
  26. var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
  27. var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();
  28. var TimeValue =(" " + hours + minutes + seconds + " " + ampm);
  29.  
  30. return TimeValue;
  31. }//-->
  32.  
  33. </head>
  34. <?php
  35.  
  36. echo '<textarea id="test"></textarea>';
  37. ?>
  38. <script language=javascript>
  39. document.getElementById('test').value = getdate(DDMMYY);
  40.  
  41. </body>
  42. </html>


ps: rok ci sie źle wylicza


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 14.01.2007

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


@nospor - ale jak chce w tym polu textarea dodac jeszcze cos innego poza data

bo nic sie eni pojawia jak tam dodam


--------------------
Tutaj znajdowała się moja sygnatura, lecz niestety łamała ona regulamin i musiałem ją usunąć
teraz rozwijam swoje umiejętności graficzne i próbuję ją robić
aktualnie studiuję painta
nigdy nie myślałem, że on ma takie możliwości
Go to the top of the page
+Quote Post
nospor
post
Post #5





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Kod
<?php

echo '<textarea id="test">cos innego</textarea>';
?>
<script language=javascript>
document.getElementById('test').value += getdate(DDMMYY);
</script>

smile.gif

A nie mozesz tej daty w php wyslac?
  1. <?php
  2. echo '<textarea id="test">cos innego '.date('Y-m-d').'</textarea>';
  3. ?>


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
kamil9091
post
Post #6





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 14.01.2007

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


Cytat(nospor @ 11.05.2007, 08:44:58 ) *
Kod
<?php

echo '<textarea id="test">cos innego</textarea>';
?>
<script language=javascript>
document.getElementById('test').value += getdate(DDMMYY);
</script>

smile.gif


ale wlasnie tak nei dziala
Cytat(nospor @ 11.05.2007, 08:44:58 ) *
A nie mozesz tej daty w php wyslac?
  1. <?php
  2. echo '<textarea id="test">cos innego '.date('Y-m-d').'</textarea>';
  3. ?>



w sumie to moge....

tak tez moze byc

dziki za pomoc

Ten post edytował kamil9091 11.05.2007, 12:01:43


--------------------
Tutaj znajdowała się moja sygnatura, lecz niestety łamała ona regulamin i musiałem ją usunąć
teraz rozwijam swoje umiejętności graficzne i próbuję ją robić
aktualnie studiuję painta
nigdy nie myślałem, że on ma takie możliwości
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 21.08.2025 - 15:34