Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Ukrywanie i ujawnianie inputów
adeq_PL
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 25.01.2006
Skąd: Oświęcim

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


Witam.

Mam nastepujacy problem. Napisalem formularz, ktorego zrodlo znajduje sie ponizej i chcialbym do niego dorobic nastepujacy skrypt.

Chcialbym zeby po zaznaczeniu checkboxa pojawialy sie 4 pozostale imputy, ktore sa typu text, natomiast po jego odznaczeniu chcialbym zeby sie ukrywaly.

A oto i kod:

  1. <?php
  2.  
  3. $tablica = array ("Pn.-Pt.", "Poniedziałek", "Wtorek", "&para;roda", "Czwatrek", "Pi&plusmn;tek", "Sobota", "Niedziela");
  4.  
  5. echo "<table width=350 cellpadding='1' cellspacing='0'>";
  6.  
  7. for($ile=0;$ile<=7;$ile++){
  8.  
  9.  echo "<tr><td align='left'>";
  10.  
  11.  echo "<input type='checkbox' name='dni[]' value=$tablica[$ile]>
  12.  <font class=edytuj>$tablica[$ile]</font>
  13.  </td><td>
  14.  
  15. <font class=edytuj> od: </font>
  16. <input type='text' size='1' name='godzod[$ile]' maxlength='2'> 
  17. <font class=edytuj> : </font>
  18. <input type='text' size='1' name='minod[$ile]' maxlength='2'>
  19. <font class=edytuj> do: </font>
  20. <input type='text' size='1' name='godzdo[$ile]' maxlength='2'>
  21. <font class=edytuj> : </font>
  22. <input type='text' size='1' name='mindo[$ile]' maxlength='2'>";
  23.  
  24. echo "</td></tr>";
  25. }
  26. echo "</table>";
  27.  
  28. ?>


Mam nadzieje ze jest to mozliwe do realizacji. Dzieki za kazda pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
adeq_PL
post
Post #2





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 25.01.2006
Skąd: Oświęcim

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


nospor zrobilem jak kazales ale nadal mi wyskakuje jakis blad :/

Moglbys jeszcze raz na to looknac?

  1. <?php
  2. echo "<script language='JavaScript'>
  3.  
  4. function show(0)
  5. {
  6.  obj=document.getElementById('div_0');
  7.  obj.style.display='';
  8. }
  9. function show(1)
  10. {
  11.  obj=document.getElementById('div_1');
  12.  obj.style.display='';
  13. }
  14. function show(2)
  15. {
  16.  obj=document.getElementById('div_2');
  17.  obj.style.display='';
  18. }
  19. function show(3)
  20. {
  21.  obj=document.getElementById('div_3');
  22.  obj.style.display='';
  23. }
  24. function show(4)
  25. {
  26.  obj=document.getElementById('div_4');
  27.  obj.style.display='';
  28. }
  29. function show(5)
  30. {
  31.  obj=document.getElementById('div_5');
  32.  obj.style.display='';
  33. }
  34. function show(6)
  35. {
  36.  obj=document.getElementById('div_6');
  37.  obj.style.display='';
  38. }
  39. function show(7)
  40. {
  41.  obj=document.getElementById('div_7');
  42.  obj.style.display='';
  43. }
  44.  
  45.  </script>";
  46.  
  47.  
  48. $tablica = array ("Pn.-Pt.", "Poniedziałek", "Wtorek", "&para;roda", "Czwatrek", "Pi&plusmn;tek", "Sobota", "Niedziela");
  49.  
  50.  echo "<table width=350 cellpadding='1' cellspacing='0'>";
  51.  
  52. for($ile=0;$ile<=7;$ile++){
  53.  
  54.  echo "<tr><td align='left'>";
  55.  
  56.  echo "<input type='checkbox' onClick='show($ile)' name='dni[]' value=$tablica[$ile]>
  57.  <font class=edytuj>$tablica[$ile]</font>
  58.  
  59.  </td><td>";
  60.  
  61. echo "<div id='div_$ile' style='display:none'>
  62. <font class=edytuj> od: </font><input type='text' size='1' name='godzod[$ile]' maxlength='2'> 
  63. <font class=edytuj> : </font><input type='text' ' size='1' name='minod[$ile]' maxlength='2'>
  64. <font class=edytuj> do: </font><input type='text' size='1' name='godzdo[$ile]' maxlength='2'>
  65. <font class=edytuj> : </font><input type='text' size='1' name='mindo[$ile]' maxlength='2'>
  66. </div>";
  67.  
  68. echo "</td></tr>";
  69.  
  70.  }
  71.  
  72.  
  73. echo "</table>";
  74.  
  75. ?>


co robie zle?
Go to the top of the page
+Quote Post

Posty w temacie


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: 10.10.2025 - 02:51