Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript] wpis chyba w złym miejscu
shpaque
post 15.01.2014, 14:17:47
Post #1





Grupa: Zarejestrowani
Postów: 651
Pomógł: 3
Dołączył: 31.01.2011
Skąd: Warszawa

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


Witam ponownie, mam przy checkboxie wpis:
  1. <input type="checkbox" id="f-check" name="f-check" value="dane do faktury z pieczątki"/><script>
  2. $('#f-check').click(function()
  3. {
  4. if ($('#f-check').prop('checked'))
  5. {
  6. $('#f-firma').css('background-color', '#CCCCCC');
  7. $('#k-email').css('background-color', '#CCCCCC');
  8. }
  9. else
  10. {
  11. $('#f-firma').css('background-color', '#FFFFFF');
  12. }
  13. });
  14. </script>


dla przykładu element o id "f-firma" jest po tym kodzie, ale się nie wykonuje. całość wygląda tak:

  1. ...
  2. #f-imie
  3. {
  4. position: absolute;
  5. left: 240px;
  6. top: 90px;
  7. width: 198px;
  8. height: 19px;
  9. line-height: 19px;
  10. z-index: 8;
  11. }
  12. #f-check
  13. {
  14. position: absolute;
  15. left: 240px;
  16. top: 33px;
  17. z-index: 5;
  18. }
  19. #uwagi
  20. {
  21. position: absolute;
  22. left: 685px;
  23. top: 35px;
  24. width: 223px;
  25. height: 163px;
  26. z-index: 21;
  27. }
  28. #wys-miasto
  29. {
  30. position: absolute;
  31. left: 535px;
  32. top: 120px;
  33. width: 123px;
  34. height: 19px;
  35. line-height: 19px;
  36. z-index: 19;
  37. }
  38. #f-miasto
  39. {
  40. position: absolute;
  41. left: 315px;
  42. top: 150px;
  43. width: 123px;
  44. height: 19px;
  45. line-height: 19px;
  46. z-index: 11;
  47. }
  48. #f-adres
  49. {
  50. position: absolute;
  51. left: 240px;
  52. top: 120px;
  53. width: 198px;
  54. height: 19px;
  55. line-height: 19px;
  56. z-index: 9;
  57. }
  58. #k-tel
  59. {
  60. position: absolute;
  61. left: 20px;
  62. top: 65px;
  63. width: 198px;
  64. height: 19px;
  65. line-height: 19px;
  66. z-index: 2;
  67. }
  68. #wb_t1
  69. {
  70. position: absolute;
  71. left: 20px;
  72. top: 10px;
  73. width: 250px;
  74. height: 19px;
  75. z-index: 0;
  76. text-align: left;
  77. }
  78. #wb_t2
  79. {
  80. position: absolute;
  81. left: 240px;
  82. top: 10px;
  83. width: 207px;
  84. height: 19px;
  85. z-index: 4;
  86. text-align: left;
  87. }
  88. #wb_uid0
  89. {
  90. color: #000000;
  91. font-family: Arial;
  92. font-size: 16px;
  93. }
  94. </head>
  95. <div id="space"><br></div>
  96. <div id="container">
  97. <div id="wb_t1">
  98. <span id="wb_uid0"><strong>DANE KONTAKTOWE</strong></span>
  99. </div>
  100. <input type="text" id="k-imie" name="k-imie" value="" autocomplete="off" placeholder="Imię i nazwisko">
  101. <input type="text" id="k-tel" name="k-tel" value="" autocomplete="off" placeholder="Telefon kontaktowy">
  102. <input type="email" id="k-email" name="k-email" value="" autocomplete="off" placeholder="E-mail">
  103. <div id="wb_t2">
  104. <span id="wb_uid1"><strong>DANE DO FAKTURY VAT</strong></span>
  105. </div>
  106. <input type="checkbox" id="f-check" name="f-check" value="dane do faktury z pieczątki"><script>
  107. $('#f-check').click(function()
  108. {
  109. if ($('#f-check').prop('checked'))
  110. {
  111. $('#f-firma').css('background-color', '#CCCCCC');
  112. $('#k-email').css('background-color', '#CCCCCC');
  113. }
  114. else
  115. {
  116. $('#f-firma').css('background-color', '#FFFFFF');
  117. }
  118. });
  119. <input type="text" id="f-firma" name="f-firma" value="" autocomplete="off" placeholder="Nazwa firmy">
  120. <div id="wb_t3">
  121. <span id="wb_uid2"><strong>TAKIE SAME JAK NA PIECZĄTCE</strong></span>
  122. </div>
  123. <input type="text" id="f-imie" name="f-imie" value="" autocomplete="off" placeholder="Imię i nazwisko / ciąg dalszy nazwy firmy">
  124. <input type="text" id="f-adres" name="f-adres" value="" autocomplete="off" placeholder="Adres (ulica, numer)">
  125. <input type="text" id="f-kod" name="f-kod" value="" autocomplete="off" placeholder="Kod pocztowy">
  126. <input type="text" id="f-miasto" name="f-miasto" value="" autocomplete="off" placeholder="Miejscowość">
  127. <input type="text" id="f-nip" name="f-nip" value="" autocomplete="off" placeholder="NIP">
  128. <div id="wb_t4">
  129. <span id="wb_uid3"><strong>INFORMACJE DODATKOWE</strong></span>
  130. </div>
  131. <div id="wb_t5">
  132. <span id="wb_uid4"><strong>DANE DO WYSYŁKI</strong></span>
  133. </div>
  134. <input type="checkbox" id="wys-check" name="wys-check" value="dane do wysyłki z pieczątki">
  135. <input type="text" id="wys-imie" name="wys-imie" value="" autocomplete="off" placeholder="Imię i nazwisko / Nazwa firmy">
  136. <input type="text" id="wys-adres" name="wys-adres" value="" autocomplete="off" placeholder="Adres (ulica, numer)">
  137. <input type="text" id="wys-kod" name="wys-kod" value="" autocomplete="off" placeholder="Kod pocztowy">
  138. <input type="text" id="wys-miasto" name="wys-miasto" value="" autocomplete="off" placeholder="Miejscowość">
  139. <div id="wb_t6">
  140. <span id="wb_uid5"><strong>TAKIE SAME JAK NA PIECZĄTCE</strong></span>
  141. </div>
  142. <textarea name="uwagi" id="uwagi" rows="9" cols="31"></textarea>
  143. </div>
  144. </body>
  145. </html>
Go to the top of the page
+Quote Post
werdan
post 15.01.2014, 14:23:14
Post #2





Grupa: Zarejestrowani
Postów: 354
Pomógł: 100
Dołączył: 14.11.2013
Skąd: Płock

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


Skrypt działa, co jest nie tak?

http://jsbin.com/eSImIdi/1/edit
Go to the top of the page
+Quote Post
shpaque
post 15.01.2014, 14:26:23
Post #3





Grupa: Zarejestrowani
Postów: 651
Pomógł: 3
Dołączył: 31.01.2011
Skąd: Warszawa

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


no tak, jQuery smile.gif

Ten post edytował shpaque 15.01.2014, 14:41:46
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 Wersja Lo-Fi Aktualny czas: 16.04.2024 - 12:59