urgent code ou est l'erreur

urgent code ou est l'erreur - HTML/CSS - Programmation

Marsh Posté le 29-06-2005 à 16:00:11    

voila mon code

Code :
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2.      <html>
  3.     <head>
  4.      <title>Fiche de frais de déplacements</title>
  5.      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6.      <script language="javascript"> 
  7.    
  8.      var fois=0; 
  9.    
  10.      boutrep = new Array();
  11.    
  12.      function launch(form){
  13.      fonct_form(form);
  14.      calcul(form);
  15.      }
  16.    
  17.      function calcul(form)
  18.      {
  19.      alert (document.form.r3.value);
  20.      }
  21.    
  22.      function fradio1(bouton,reponse)
  23.      {
  24.      boutrep[bouton]=reponse
  25.      }
  26.      function testsubmit() {
  27.          if (document.fichedep.action=="" ) return false
  28.      return true
  29.      } 
  30.    
  31.      //fonction pour choisir l'action   
  32.      function gopage(page) 
  33.      {
  34.          document.fichedep.action = page; 
  35.          document.fichedep.submit(); 
  36.      } 
  37.    
  38.      function fonct_form(form) {
  39.      resultat='<html>\n<title>Ligne enregistrée</title>\n<head>\n</head>\n<body>\n';
  40.      err ="";
  41.      //verifacation des champs vides
  42.      if (form.datage.value == "" ) {
  43.      err +="Indiquez la date !\n";
  44.      }
  45.      if (form.villedep.value == "" ) {
  46.      err +="Indiquez la ville de depart !\n";
  47.      }
  48.      if (form.villear.value == "" ) {
  49.      err +="Indiquez la ville d'arrivée !\n";
  50.     }
  51.      if (form.km.value == "" ) {
  52.      err +="Indiquez le nombre de km !\n";
  53.      }
  54.      if (form.motif.value == "" ) {
  55.      err +="Indiquez le motif !\n";
  56.      }
  57.      if (form.r1.value == "" ) {
  58.      err +="Indiquez le tarif !\n";
  59.      }
  60.    
  61.      if (err != "" ) {
  62.      alert(err);
  63.      }
  64.      else{
  65.    
  66.      resultat +="<p align=\"center\">Les valeurs entrées sont: ";
  67.      resultat += " "+form.datage.value+" "+form.villedep.value+" "+form.villear.value+" "+titi;
  68.      resultat +="</p>\n</body>\n</html>";
  69.      if (fois == 1 ) result.close();
  70.    
  71.      result=open("","resultat","scrollbars=1, resizable=1, top=1, left=50, width=500, height=200" );
  72.      result.document.write(resultat)
  73.      result.document.write('<p align="center" ><a href="javascript:window.close();">Fermer cette fenêtre</a></p>')
  74.      fois=1;
  75.      }}
  76.      </script>
  77.      </head>
  78.    
  79.      <body>
  80.      <div align="center">
  81.        <p>Fiche de frais de d&eacute;placements</p>
  82.        <p>&nbsp;</p>
  83.      </div>
  84.        <p align="left">
  85.      <form action="" method="post" name="fichedep" id="fichedep" onSubmit="return testsubmit()">
  86.        <p>Période :
  87.          <input type="text" name="periode" value="">
  88.      </p>
  89.        <table width="100%" border="1">
  90.          <tr>
  91.            
  92.            <th scope="col">Date</th>
  93.            <th scope="col">Ville D&eacute;part </th>
  94.            <th scope="col">Ville Arriv&eacute;e </th>
  95.            <th scope="col">Aller/retour</th>
  96.            <th scope="col">Motif</th>
  97.            <th scope="col">Tarif</th>
  98.            <th scope="col">Km</th>
  99.              <th scope="col">Total</th>
  100.          </tr>
  101.          <tr>
  102.            <td><input size=10 name="datage" maxlength="100"></td>
  103.    
  104.      <td><input size=10 name="villedep" value=""></td>
  105.    
  106.      <td><input type="text" size="10" name="villear" maxlength="200"></td>
  107.    
  108.      <td><input type="radio" name="r3" value="Aller" onClick="fradio1(3,this.value)">Aller<br>
  109.          <input type="radio" name="r3" value="Aller Retour" onClick="fradio1(3,this.value)">Aller Retour</td>
  110.    
  111.      <td><input type="text" size="10" name="motif" maxlength="200"></td>
  112.    
  113.      <td><input type="radio" name="r1" value="0.30" checked="checked">0.30€<br>
  114.          <input type="radio" name="r1" value="0.35" >0.35€</td>
  115.    
  116.      <td><input type="text" size="10" name="km" maxlength="200"></td>
  117.      <td><input type="button" value="Calculer" onClick="launch(this.form)"></td>
  118.      </tr>
  119.    
  120.          
  121.        </table>
  122.        <p><br>
  123.          <input type="submit" value="retour" onClick="gopage('identite.php')">
  124.          <input type="submit" value="Valider" onClick="gopage('nouveaupdf.php')">
  125.        </p>
  126.    
  127.      </form></p>
  128.    
  129.      </body>
  130.      </html>


 
     
 
 
et mon probleme se situe au niveau de la fonction calcul:
ca me sort tjs le message "undefined" qq un peu t il me dire ou est le pb?
c'ets urgent merci!

Reply

Marsh Posté le 29-06-2005 à 16:00:11   

Reply

Marsh Posté le 29-06-2005 à 16:01:03    

Apprend l'HTML et le JS comme on le fait en 2005, t'aura 100 fois moins de problèmes :o

Reply

Marsh Posté le 29-06-2005 à 16:02:57    

ouais parce que language="javascript", c'est déprécié. C'est à dire que ca ne doit plus être utilisé.
 
A la place on met type="text/javascript".
 
Ensuite, on accède aux éléments par document.getElementById('nomdelelement').qqch (value,style, ou autre)


---------------
http://www.alsacreations.com , http://www.openweb.eu.org. Mon CV : http://cv.roane-irkana.net/. Exemple à ne surtout pas suivre : www.worldinternet.be
Reply

Marsh Posté le 29-06-2005 à 16:13:27    

L4ERREUR ELLE EST ENTRE LA CHAISE ET LE CLAVIER HAHAHAHAHAHA /FOU//FOU//FOU/ /PINGOUINO/


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 29-06-2005 à 16:20:07    

Ca y es masklinn pète un cable ! Masklinn tiens bon c'est pas encore vendrediiiiiii :D


---------------
http://www.alsacreations.com , http://www.openweb.eu.org. Mon CV : http://cv.roane-irkana.net/. Exemple à ne surtout pas suivre : www.worldinternet.be
Reply

Marsh Posté le 29-06-2005 à 16:37:28    

merci plainofpain au moins toi tes reponses serve a qq chose

Reply

Marsh Posté le 29-06-2005 à 16:39:13    

Ben je t'ai déjà expliqué dans d'autres topics comment faire. Après si t'arrive pas à refaire ça sur une autre page [:spamafote]

Reply

Marsh Posté le 29-06-2005 à 16:40:20    

mais maintenant j'ai l'erreur document.getElementById('r3').value has no properties????
ca viens d'ou et comment on regele ce pb?

Reply

Marsh Posté le 29-06-2005 à 16:41:04    

Parce que getElementById cherche un élément avec un certain id. Déjà mangé du port-salut ?

Reply

Marsh Posté le 29-06-2005 à 16:50:04    

Non le port salut c'est degeu, mais merci pour la reponse ca marche maintenant!

Reply

Marsh Posté le 29-06-2005 à 16:50:04   

Reply

Marsh Posté le 29-06-2005 à 20:04:52    

Et puis, passe en XHTML 1.1

Reply

Marsh Posté le 29-06-2005 à 20:45:12    

Paracetamol a écrit :

Et puis, passe en XHTML 1.1


Trop ta gueule [:aloy]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 30-06-2005 à 09:06:25    

Paracetamol a écrit :

Et puis, passe en XHTML 1.1


Pas géré par IE [:spamafote] Ou alors tu fais partie de ce groupe de gens qui envoient leur pages en text/html ;)

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed