Javascript devis simple ...ça ne marche pas

Fermé
meuhj - 31 mai 2009 à 18:29
hamzafes Messages postés 243 Date d'inscription lundi 26 juin 2006 Statut Membre Dernière intervention 4 mai 2013 - 31 mai 2009 à 20:44
Bonjour,
mon code ne marche toujours pas malgrès votre aide et je ne sais toujours pas pourquoi ....
J'essai de faire un devis très bête en utilisant javascript...
quelqu'un pour m'aider ?
merci d'avance

mon code :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script type="javascript">

Function 'calcul ()' {

var "volume"= document.kalkul.getElementById("volume").value;

var "km"= document.kalkul.getElementById("km").value;

document.kalkul.getElementById("total").value= Math.round(getElementById("volume")*27.45)+(getElementById("km")*1).value;
}

</script>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Devis</title>

<script type="text/javascript">
<!--
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
//-->
</script>
</head>

<body>
<p>Devis</p>
<form id="kalkul" name="kalkul" method="post" action="">
<label> <br />
Volume :
<input type="text" name="volume" id="volume" />
</label>
m3
<p>
<label>
Distance
<input type="text" name="km" id="km" />
</label>
km</p>
<p>
<label>
<input name="calculer" type="button" id="calculer"
onclick="MM_callJS('calcul ()')"value="calculer" />
<br />
<br />
Total Ht
<input name="total" type="text" id="total" onclick="calcul"/>
</label>
<label>
€<br />
<br />
</label>
</p>
</form>
</body>
</html>
A voir également:

1 réponse

hamzafes Messages postés 243 Date d'inscription lundi 26 juin 2006 Statut Membre Dernière intervention 4 mai 2013 54
31 mai 2009 à 20:44
Pourquoi les "" autour de chaque variable?
0