Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jscript - checked
ennics
post
Post #1





Grupa: Zarejestrowani
Postów: 312
Pomógł: 0
Dołączył: 29.12.2004

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


mam taki problem

  1. function uncheckAll() {
  2. this.form.proc1_addresChange.checked=false;
  3. }
  4.  
  5. <input id="proc1" type="radio" name="proc" value="zm_st" onclick="javascript:{ uncheckAll(); }">
  6.  
  7. <input id="proc1_addresChange" type="radio" name="st_type" value="addrCh">

kiedy klikam na radio name="zm_st" nie "odznacza" się radio name="st_type"
coś jest nie tak w tej funkcji ale jestem zielony w jscript..
pomożecie ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

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


Da sie:
  1.  
  2. <head>
  3. <script type="text/javascript">
  4. function unselectRadios()
  5. {
  6. inputy = document.getElementsByTagName( 'input' );
  7.  
  8. for ( i = 0; i < inputy.length; i++ )
  9. {
  10. if ( inputy[ i ].hasAttribute( 'type' ) )
  11. {
  12. // dodany warunek
  13. ---8<---------------
  14. if ( inputy[ i ].type == 'radio' )
  15. {
  16. inputy[ i ].checked = false;
  17. }
  18. // ---------------8<---
  19. }
  20. }
  21. }
  22. </script>
  23. </head>
  24. <body>
  25. <form id="formularz">
  26. <input type="radio" name="r1" value="1"/><br/>
  27. <input type="radio" name="r1" value="2"/><br/>
  28. <input type="radio" name="r1" value="3" checked="checked"/><br/>
  29. <input type="radio" name="r1" value="4"/><br/>
  30. <hr />
  31. <input type="radio" name="r2" value="1" checked="checked"/><br/>
  32. <input type="radio" name="r2" value="2"/><br/>
  33. <input type="radio" name="r2" value="3"/><br/>
  34. <input type="radio" name="r2" value="4"/><br/>
  35.  
  36. <input type="button" onclick="unselectRadios()" />
  37. </form>
  38. </body>
  39. </html>


EDIT: dodalem poprzednio zapomniany warunek

Ten post edytował dr_bonzo 22.01.2005, 21:04:22
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 - 18:16