Código HTML:
<td bgcolor="#d6cfd6" width="35"> <input name="numero11" class="px2" id="numero11" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" value="1" size="2" maxlength="3" type="text">
</td>
<td bgcolor="#d6cfd6"><font color="#000000" face="Verdana" size="1"><strong>864
Euros</strong> </font></td>
</tr>
</tbody>
</table>
<script>
function NumberFormat(num,numDec,decSep,thousandSep) {
var arg;
var Dec;
Dec = Math.pow(10,numDec);
if(typeof(num) == 'undefined') return;
if(typeof(decSep) == 'undefined') decSep = ',';
if(typeof(thousandSep) == 'undefined') thousandSep = '.';
if(thousandSep == '.'){
arg=/\./g;
}else if(thousandSep == ','){
arg=/\,/g;
}
if(typeof(arg) != 'undefined'){
num = num.toString().replace(arg,'');
}
num = num.toString().replace(/,/g,'.');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*Dec+0.50000000001);
cents = num%Dec;
num = Math.floor(num/Dec).toString();
if(cents<(Dec/10))
{
cents = "0" + cents;
}
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+thousandSep+ num.substring(num.length-(4*i+3));
if(Dec==1)
return (((sign)?'':'-') + num);
else
return (((sign)?'':'-') + num + decSep + cents);
}
function EvaluateText(cadena,obj) {
opc=false;
if(cadena=="%d")
{
if((event.keyCode > 47 && event.keyCode < 58))
{
opc=true
}
}
if(cadena=="%f")
{
if((event.keyCode > 47 && event.keyCode < 58))
{
opc=true
}
if(obj.value.search("[.*]")==-1 && obj.value.length!=0)
{
if(event.keyCode==46)
opc=true;
}
}
if(opc==false)
event.returnValue = false;
}
</script> <script>
function cent(amount) {
// returns the amount in the .99 format
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}
function sumarmetros12() {
var quita = ","
//recoger valor en javascript
//metros = document.accesorios.m12.value.replace(quita,".")
//euros = document.accesorios.euros12.value
//recogemos valor en asp
metros = 4.94
euros = 15
var metro = Math.floor(metros)
var euros = Math.floor(euros)
var valortotal12=metros*euros
valortotal212=cent(valortotal12)
//valortotal12=4,94*15
document.accesorios.totalm12.value=NumberFormat(valortotal12,'2','.',',')
}
</script> <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td rowspan="2" bgcolor="#fae8da" valign="top" width="26"><input name="precio" id="precio" value="16" onclick="if (this.checked) sumarneto(Math.round((5*15) * 10)/10); else restarneto(Math.round((5*15) * 10)/10);if(this.checked) copianeto(16); else descopianeto(16);if(this.checked) copia(16,0); else descopia(16,0)" type="checkbox"></td>
<td bgcolor="#fae8da" width="328"><font color="#000000" face="Verdana" size="1"><strong>Pintura
ral</strong> </font></td>
<td bgcolor="#fae8da" width="55"><font color="#000000" face="Verdana" size="1">
<input name="m12" class="px2" id="m12" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" value="5" size="5" type="text">
</font></td>
<td bgcolor="#fae8da" width="55"><input name="euros12" class="px2" id="euros12" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" value="15" size="10" type="text">
<font color="#000000" face="Verdana" size="1"><strong></strong></font></td>
</tr>
<tr>
<td bgcolor="#fae8da" width="328"><div align="right">
<!-- <input name="totalm12" type="text" id="totalm12" style="color: #000000; background-color: #EEEEEE; border-top : 1px solid; border-bottom : 1px solid; border-left : 1px solid; border-right : 1px solid; font-family : Verdana,tahoma,Arial; font-size : 10px;" size="20" onclick="sumarmetros12()">-->
</div></td>
<td bgcolor="#fae8da" valign="bottom"><font color="#000000" face="Verdana" size="1"><strong>4,94 m<sup>2</sup></strong></font></td>
<td bgcolor="#fae8da" valign="bottom" width="55"><font color="#000000" face="Verdana" size="1"><strong>15 Euros</strong></font><font face="Verdana" size="1"><span class="Estilo6"><font color="#fae8da"><sup>2</sup></font></span></font><font color="#000000" face="Verdana" size="1"> </font></td>
</tr>
</tbody>
</table>
<br> </td>
<td bgcolor="#b7b5b7" valign="bottom" width="177"> </td>
</tr>
<tr align="center" bgcolor="#002063" valign="middle">
<td colspan="4" height="30"><input name="productos" id="productos" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="text">
<input name="total" id="total" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="text">
<input name="productosneto" id="productosneto" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="text">
<input name="neto" id="neto" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="text">
<input name="naccesorios" id="naccesorios" style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="text">
<input name="Submit" value=" Agregar accesorios " style="border: 1px solid ; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-family: Verdana,tahoma,Arial; font-size: 10px;" type="submit"></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody></table>
</form>
</body></html>
Creo qeu es un poco largo y posiblemente sobre cosas, pero si alguno puede ayudarme, gracias.
Lomejor para estos casos copiar , pegar y cuardar, para ver el funcionamiento
Un saludo