Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] Liczenie vat
DannyM
post 11.06.2012, 11:32:44
Post #1





Grupa: Zarejestrowani
Postów: 507
Pomógł: 2
Dołączył: 30.10.2003
Skąd: Poznań

Ostrzeżenie: (10%)
X----


Witam. Jak zmienic ta funkcje aby wynik byl

price * 23 / 100 + price;

teraz mam. Niestety JS to nie moja bajka sad.gif
  1. <script type="text/javascript">
  2. function oblicz(){
  3.  
  4. if(document.getElementById('cena') != null) {
  5. var wynik = parseInt(document.getElementById('cena').value) * parseInt(document.getElementById('ile').value ) / 100 + parseInt(document.getElementById('cena').value) ;
  6. document.getElementById('price').value = wynik + ".00";
  7. }
  8.  
  9. }
  10. </script>
  11. <input type="text" name="ile" id="ile" value="23" size="5" />
  12. <input type="text" name="cena" id="cena" value="" size="10" onfocus="this.select()" onkeypress="oblicz()" />
  13. = <input type="text" name="price" id="price" />


Niestety wynikiem mam 12.3.00

Ten post edytował DannyM 11.06.2012, 11:37:59
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 31.07.2025 - 10:52