|
ola galera!
� o seguinte, no exemplo que eu criei vc joga o
valor, ele multiplicar por 36, mas na hora da resposta ele considera a parte
decima.
Exemplo:
2,01 * 36 = 72,36 mas ele d� a resposta 72, o que
ser� que eu tenho que muda no c�digo fonte, que segue abaixo (e o exemplo
esta em anexo) :
<html> <head>
<title></title> </head> <body bgColor="#ffffff">
<div><font face="Arial" size="2"> <p></font> </p>
</div><div><font face="Arial" size="2"> <p></font> </p>
</div><script> // Fun��o para formata��o de string // Programador: Eu mesmo! // Propriedade: Nossa! function fstr(v){ var s = ""+v; // cria um objeto do tipo string
var ss; // recebera um array de substrings var r; // Valor formatado a ser retornado r = "";
ss = s.split("."); // separa
substrings
while (ss[0].length > 0)
{ r = "." + ss[0].substring(ss[0].length-3, ss[0].length) + r; ss[0] = ss[0].substring(0,ss[0].length-3); } if (ss.length>1)
{ switch (ss[1].length) { case 1: ss[1] += "0"; default : ss[1] = parseInt(ss[1].substr(0,2) + "." + ss[1].substr(2,ss[1].length) + "0"); } r = "R$ " + r.substring(1, r.length) + "." + ss[1]; } else {r = "R$ " + r.substring(1, r.length) + ",00"; } return(r); } </script> <blockquote style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <div><font face="Arial" size="2"><p> </font></p> </div><div><p> </p> </div><div><font face="Arial" size="2"><p> </p> <table border="1" cellSpacing="1" width="78%"> <TBODY> <tr> <td align="middle" width="50%"><font color="#0000a0"><big><strong>Valor</strong></big></font></td> <td align="middle" width="50%"><font color="#0000a0"><big><strong>vezes</strong></big></font></td> <td align="middle" width="50%"><font color="#0000a0"><big><strong>pre�o</strong></big></font></td> </tr> <tr> <td width="50%"><p align="center"><input name="T2" onblur="preco.value='Digita o Valor Coisa Feia!';if (T2.value!='')preco.value=fstr(parseFloat(T2.value)*36);" size="17"></td> <td width="50%"><p align="center"><strong>36</strong></td> <td width="50%"><input name="preco" readOnly size="20"></td> </tr> </TBODY> </table> </font></div> </blockquote> </body> </html> ---------------------------------------------------------
Francis Informatica - CPD [EMAIL PROTECTED] Bali Automoveis Ltda. 61 362-6224 ICQ.: 51582330 --------------------------------------------------------- "Mais inteligente � aquele que sabe que n�o sabe" "O verdadeiro conhecimento
vem de dentro"
S�crates
440 a.C. |
|
