Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [javascript] skrypt wyboru
mari6274
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 8.05.2012

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


Mógłby mi ktoś powiedzieć, czy taki skrypt ma prawo działać(IMG:style_emoticons/default/questionmark.gif) Jesli nie to dlaczego, jeśli tak to co robie źle, że nie działa mi prawidłowo.
  1. <p>
  2.  
  3. <input type='radio' name='typg' id='1' value='1' checked='checked'>
  4. <input type='radio' name='typg' id='2' value='2'>
  5. </p>
  6.  
  7.  
  8. document.getElementById('d2').style.display = 'none';
  9. if(document.getElementById(1).checked) {
  10. document.getElementById('d1').style.display = 'block';
  11. document.getElementById('d2').style.display = 'none';
  12. }
  13. else if(document.getElementById(2).checked) {
  14. document.getElementById('d2').style.display = 'block';
  15. document.getElementById('d1').style.display = 'none';
  16. }
  17.  
  18. </script>
  19.  
  20. <p>
  21. <div id='d1'>
  22.  
  23.  
  24. //skrypt JS
  25.  
  26.  
  27. </div>
  28. <div id='d2'>
  29.  
  30. //Kod HTML
  31. //+
  32. //Skrypt JS
  33.  
  34.  
  35. </div>
  36. </p>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mari6274
post
Post #2





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 8.05.2012

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


Jest problem. Zawartość diva pojawia się po wybraniu opcji i odświeżeniu strony, a nie o to mi chodziło :/
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: 22.08.2025 - 19:40