Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [js][ajax?]Naprzemian zmienijące się tło divów
b_chmura
post
Post #1





Grupa: Zarejestrowani
Postów: 813
Pomógł: 34
Dołączył: 18.03.2007
Skąd: o stamtąd

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


Witam
Jeśli byłby ktoś na tyle miły i przedstawił jakąś funkcje która na przemian zmienia tło divom o jakimś tam ID


<div>czarne tło</div>
<div>białe tło</div>
<div>czarne tło</div>
<div>białe tło</div>
<div>czarne tło</div>
<div>białe tło</div>
<div>czarne tło</div>
<div>białe tło</div>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nospor
post
Post #2





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




  1. <head>
  2. <style type="text/css" media="all">
  3.  
  4. .black{
  5. background-color:black;
  6. }
  7. .white{
  8. background-color:white;
  9. }
  10. </style>
  11. <script language="javascript">
  12. function change() {
  13. var obj = document.getElementById('div');
  14. obj.className = obj.className =="black" ? "white" : "black";
  15. }
  16. </script>
  17. </head>
  18. <body>
  19. <div class="black" id="div" style="color:red">Jestem divem</div>
  20. <button type="button" onClick="change();">click me</button>
  21. </body>
  22. </html>
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: 2.10.2025 - 16:33