
Originariamente inviata da
cavicchiandrea
se non funziona nenche cosi non so che dirti:
codice:
var totale-generale = ((document.autoSumForm.tot_art001.value * 1) + (document.autoSumForm.tot_art002.value * 1) + (document.autoSumForm.tot_art003.value * 1) + (document.autoSumForm.tot_art004.value * 1) + (document.autoSumForm.tot_art005.value * 1) + (document.autoSumForm.tot_art006.value * 1) + (document.autoSumForm.tot_art007.value * 1) + (document.autoSumForm.tot_art008.value * 1) + (document.autoSumForm.tot_art009.value * 1) + (document.autoSumForm.tot_art010.value * 1))
document.autoSumForm.totale_generale.value = totale-generale.toFixed(2)
Nada, addirittura fa peggio (nel senco che non fa più il calcolo automatico).
Al momento sono arrivato a fare così, ogni tanto però il problema si presenta:
codice:
<!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" xml:lang="it" lang="it">
<head>
<style type="text/css">
<!--
body {background: #d1d1d1; font-family: 'Calibri'}
p {color: #000; margin: 0px; padding: 0px;}
@font-face {font-family: 'Calibri'; src: url("common/calibri.ttf");}
-->
</style>
</head>
<body>
<script type="text/javascript">
<!-- Begin
function startCalc(){
interval = setInterval("calc()",1);
}
function calc(){
art001 = document.autoSumForm.art001.value;
document.autoSumForm.tot_art001.value = ((art001 * 1) * (1.20 * 1)).toFixed(2);
art002 = document.autoSumForm.art002.value;
document.autoSumForm.tot_art002.value = ((art002 * 1) * (1.20 * 1)).toFixed(2);
art003 = document.autoSumForm.art003.value;
document.autoSumForm.tot_art003.value = ((art003 * 1) * (1.20 * 1)).toFixed(2);
art004 = document.autoSumForm.art004.value;
document.autoSumForm.tot_art004.value = ((art004 * 1) * (1.20 * 1)).toFixed(2);
art005 = document.autoSumForm.art005.value;
document.autoSumForm.tot_art005.value = ((art005 * 1) * (1.20 * 1)).toFixed(2);
art006 = document.autoSumForm.art006.value;
document.autoSumForm.tot_art006.value = ((art006 * 1) * (1.00 * 1)).toFixed(2);
art007 = document.autoSumForm.art007.value;
document.autoSumForm.tot_art007.value = ((art007 * 1) * (1.00 * 1)).toFixed(2);
art008 = document.autoSumForm.art008.value;
document.autoSumForm.tot_art008.value = ((art008 * 1) * (1.00 * 1)).toFixed(2);
art009 = document.autoSumForm.art009.value;
document.autoSumForm.tot_art009.value = ((art009 * 1) * (0.75 * 1)).toFixed(2);
art010 = document.autoSumForm.art010.value;
document.autoSumForm.tot_art010.value = ((art010 * 1) * (1.00 * 1)).toFixed(2);
document.autoSumForm.totale_generale.value =
(document.autoSumForm.tot_art001.value * 1) +
(document.autoSumForm.tot_art002.value * 1) +
(document.autoSumForm.tot_art003.value * 1) +
(document.autoSumForm.tot_art004.value * 1) +
(document.autoSumForm.tot_art005.value * 1) +
(document.autoSumForm.tot_art006.value * 1) +
(document.autoSumForm.tot_art007.value * 1) +
(document.autoSumForm.tot_art008.value * 1) +
(document.autoSumForm.tot_art009.value * 1) +
(document.autoSumForm.tot_art010.value * 1)
;
}
function stopCalc(){
clearInterval(interval);
}
// End -->
</script>
<hr />
<p style="text-align: center;">Oggi è <?php echo (date("d-m-y"));?></p>
<hr />
<div style="width: 610px; margin-left: auto; margin-right: auto;">
<form action="#" method="post" name="autoSumForm">
<input type="hidden" name="form_tools_form_id" value="1" />
<table style="border-collapse: collapse;">
<tr style="height: 40px;">
<td><p>Classe:</p></td>
<td><input type="text" name="classe" size="5" maxlength="5" value="" /></td>
<td><p>Sezione:</p></td>
<td><input type="text" name="sezione" size="5" maxlength="5" value="" /></td>
</tr>
</table>
<table style="border-collapse: collapse;">
<tr style="height: 40px;">
<td>
<p>Rappresentante di Classe:</p>
<p style="color: #747474; font-size: 0.8em;">(indicare il nominativo di chi effettua l'ordine)</p>
</td>
<td>
<input type="text" name="rappresentante_classe" size="20" maxlength="40" value="" />
</td>
</tr>
</table>
<p style="background: #fffc00; font-size: 1.2em;">Attenzione: i dati immessi dopo l'invio dell'ordine non sono modificabili!</p>
<table style="border-collapse: collapse;">
<tr style="height: 40px;">
<td style="width: 1000px;"><p>PRODOTTO</p></td>
<td style="width: 100px;"><p>QUANTITA'</p></td>
<td style="width: 100px;"><p>TOTALE</p></td>
</tr>
<tr style="height: 25px;">
<td><p>Piadina artigianale con salame e formaggio (1,20 Euro):</p></td>
<td><input type="text" name="art001" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art001" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Piadina artigianale con prosciutto cotto e formaggio (1,20 Euro):</p></td>
<td><input type="text" name="art002" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art002" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Piadina artigianale con porchetta e salsa saporita (1,20 Euro):</p></td>
<td><input type="text" name="art003" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art003" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Hot dog al latte con wurstel al pollo con ketchup (1,20 Euro):</p></td>
<td><input type="text" name="art004" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art004" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Hot dog al latte con wurstel al pollo con maionese (1,20 Euro):</p></td>
<td><input type="text" name="art005" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art005" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Mandolina farcita al prosciutto coto e maionese (1,00 Euro):</p></td>
<td><input type="text" name="art006" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art006" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Mandolina farcita al formaggio e speck (1,00 Euro):</p></td>
<td><input type="text" name="art007" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art007" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Mandolina farcita al formaggio e prosciutto cotto (1,00 Euro):</p></td>
<td><input type="text" name="art008" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art008" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Focaccia vuota (0,75 Euro):</p></td>
<td><input type="text" name="art009" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art009" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 25px;">
<td><p>Focaccia farcita con prosciutto cotto (1,00 Euro):</p></td>
<td><input type="text" name="art010" size="2" maxlength="2" value="" onFocus="startCalc();" onBlur="stopCalc();" /></td>
<td><input type="text" name="tot_art010" size="5" maxlength="5" readonly onFocus="startCalc();" onBlur="stopCalc();" /></td>
</tr>
<tr style="height: 40px; background-image: url(http://www.bachirovigo.it/dati/159.gif); background-repeat: repeat;">
<td style="padding: 10px;"><p style="color: #ff0000; font-weight: bold;">TOTALE:</p></td>
<td></td>
<td><input type="num" name="totale_generale" size="5" maxlength="5" readonly /></td>
</tr>
</table>
<table style="border-collapse: collapse;">
<tr style="height: 140px;">
<td>
<p>Note:</p>
<p style="color: #747474; font-size: 0.8em;">Indicare eventuali informazioni per il confezionamento dei prodotti</p>
</td>
<td>
<textarea name="messaggio" id="messaggio" cols="40" rows="8"></textarea>
</td>
</tr>
<tr>
<td>
<p>Invia dati</p>
<p style="color: #ff0000; font-size: 0.8em;"><b>Attenzione</b>: prima di Inviare i dati controllare quanto inserito, non sará possibile effettuare modifiche</p>
</td>
<td>
<input type="submit" value="Invia dati" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>