Javascript devis simple ...ça ne marche pas
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>
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>
Configuration: Windows XP Firefox 3.0.10