Javascript event problem

Répondre
jacque99
le 04/11/2011 à 14:09
jacque99
Hello everyone,
If I type the name, and I check and Gender Scholar, my button will

appear
What I am looking to:
Check my buttons, and when I start typing the name, the button

Submit appear, st if I delete the text, the Submit button

disappear

Here's the script:

*****************************************


  1. <head>
  2. <script type="text/javascript" src="jquery.validate.js"></script>
  3. <script>
  4. $(document).ready(function(){
  5. $("#commentForm").validate();
  6. });
  7. function check_required(){

  8. //alert(document.getElementById('rdo_boursier_oui').checked);
  9. //alert(document.getElementById('txt_lastname').value != "");
  10. if((document.getElementById('rdo_boursier_oui').checked == true

  11. || document.getElementById('rdo_boursier_non').checked == true) &&

  12. (document.getElementById('rdo_sexe_eleve_m').checked == true ||

  13. document.getElementById('rdo_sexe_eleve_f').checked == true)

  14. && (document.getElementById('txt_lastname').value != "" )


  15. )
  16. {
  17. document.getElementById

  18. ('submit_etape2').style.display='block';
  19. }else{
  20. document.getElementById

  21. ('submit_etape2').style.display='none';
  22. }
  23. }
  24. </script>
  25. </head>


  26. <form action="#" method="post" id="commentForm">
  27. <input class="submit" type="submit" name="submit_etape2"

  28. id="submit_etape2" value="" style="display:none;"/>

  29. <p class="p_float">
  30. <label for="lastname">Votre nom<span

  31. class="required_red">*</span></label>
  32. <input type="text" name="txt_lastname"

  33. id="txt_lastname" value="" class="required" minlength="3"

  34. onchange="check_required();"
  35. />
  36. </p>


  37. <p class="p_float rdo">
  38. <label for="boursier">Boursier<span

  39. class="required_red">*</span></label>

  40. <input type="radio" name="rdo_boursier"

  41. id="rdo_boursier_oui" value="" class="rdo_sexe_eleve snd_inscription

  42. required" onclick="check_required();"/>Oui
  43. <input type="radio" name="rdo_boursier"

  44. id="rdo_boursier_non" value="" class="rdo_sexe_eleve snd_inscription

  45. required" onclick="check_required();"/>Non
  46. </p>

  47. <p class="p_float rdo">
  48. <label for="sexe">Sexe<span

  49. class="required_red">*</span></label>
  50. <input type="radio"

  51. name="rdo_sexe_eleve" id="rdo_sexe_eleve_m" class="rdo_sexe_eleve

  52. snd_inscription required" onclick="check_required();" value="">M
  53. <input type="radio"

  54. name="rdo_sexe_eleve" id="rdo_sexe_eleve_f" class="rdo_sexe_eleve

  55. snd_inscription required" onclick="check_required();" value="">F
  56. </p>



  57. </form>
jacque
LupusMic
le 07/11/2011 à 00:06
LupusMic
Tu devrais réécrire ta question en français…
Développeur récurrent, procédural et relationnel. Caustique soupe-au-lait.
jacque99
le 10/11/2011 à 19:47
jacque99
Je pense quelque chose de ce type :
http://babylon-design.com/eviter-conflit-javascript-window-onload/
jacque
Répondre

Ecrire un message

Votre message vient d'être créé avec succès.
LoadingChargement en cours