<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http: //www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http: //www.w3.org/1999/xhtml" xml: lang="en" lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<style type="text/css">
label
{
font-size:90%;
display:block;
float:left;
width:150px;
text-align:right;
margin:10px 5px 0px 0px;
}
input
{
width:220px;
margin:5px 0px 0px 0px;
border-width: 1px 1px 4px 1px;
border-style: solid solid ridge solid;
border-color:#657887;
font-family:Arial, Helvetica, sans-serif;
padding:1px 2px;
}
</style>
<script language="javascript" type="text/javascript">
function ConvalidaModulo()
{
var PrezzoLordo = document.frmDati.PrezzoLordo.value;
var PercSconto = document.frmDati.PercSconto.value;
var x = 0;
document.frmDati.ScontoCalc.value = "";
document.frmDati.PrezzoNetto.value = "";
if((PrezzoLordo == "")||(PrezzoLordo == "undefined"))
{
alert("Il Prezzo lordo è obbligatorio");
document.frmDati.PrezzoLordo.focus();
return false;
}
else if((PercSconto == "")||(PercSconto == "undefined"))
{
alert("La percentuale di sconto è obbligatoria");
document.frmDati.PercSconto.focus();
return false;
}
else
{
x = PrezzoLordo * PercSconto / 100;
x = Math.round(x*100)/100;
document.frmDati.ScontoCalc.value = x;
document.frmDati.PrezzoNetto.value = parseFloat(PrezzoLordo) - parseFloat(x);
}
}
</script>
</head>
<body>
<form name="frmDati" method="POST" action="ValidazioneForm.html">
<fieldset>
<label for='PrezzoLordo'>Prezzo lordo : </label>
<input type='text' name='PrezzoLordo' id='PrezzoLordo' />
<br />
<label for='PercSconto'>Perventuale sconto : </label>
<input type='text' name='PercSconto' id='PercSconto' />
<br />
<label for='ScontoCalc'>Sconto calcolato : </label>
<input type='text' name='ScontoCalc' id='ScontoCalc' />
<br />
<label for='PrezzoNetto'>Prezzo netto : </label>
<input type='text' name='PrezzoNetto' id='PrezzoNetto' />
<br />
</fieldset>
<table border="0" cellpadding="10" style="margin-left:270px">
<tr align="center">
<td class="IntCol1">
<input type="button" value="Invia" id="btnInvia" tabindex="26" size="20" class="pulsante" onclick="javascript:ConvalidaModulo()"/>
</td>
<td class="Intcol1">
<input type=reset value="Cancella" id="btnCancella" name="btnCancella" tabindex="27" size="20" class="pulsante"/>
</td>
</tr>
</table>
</form>
</body>
</html>