Kalkulator JavaScript

0

Witam mam problem z obliczaniem cen w prostym sklepie internetowym. Chce zeby ceny były pomnożone przez wartośc podatku 23% oraz powiekoszne o niego i wyświetlone w <textarea>

 
<!DOCTYPE html>
<html>
    <head>
        <title>Wyzwanie</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript">
            FormMaster = new Object();
            FormMaster.resolveForm = function()
            {
              this.countVal="";
              this.topCount = document.checkRadio.length-2;
              for(var count=0; count<this.topCount; count++)
                  if(document.checkRadio.elements[count].checked || document.forms.value)
              {
                  this.countVal+=document.checkRadio.elements[count].value+"\n";
                  
               a = document.checkRadio.firstInput.value;
              b = document.checkRadio.secondInput.value;
              c = document.checkRadio.thirdInput.value;
              d = document.checkRadio.fourthInput.value;
              e = document.checkRadio.fifthInput.value;
              f = document.checkRadio.sixthInput.value;
              g = document.checkRadio.seventhInput.value;
              h = document.checkRadio.eighthInput.value;
              message = a + "\n" + b + "\n" + c + "\n" + d + "\n" + e+ "\n" + f+ "\n" + g+ "\n" + h;
              //document.checkRadio.outNow.value = message;
              
             
               // document.checkRadio.outNow.value = PriceNow;
              }
                
                WithoutTAX = document.checkRadio.price.value;
                var PriceNow = 0;
                PriceNow = WithoutTAX * 23/100 + WithoutTAX;  
              
              document.checkRadio.outNow.value = this.countVal + " " +PriceNow+ "\n" + message + "\n";
             
            };
        </script>
        <style type="text/css">
            body{
                background-color: #C0B787;
                color: #733119;
                font-family: Verdana, Geneva, sans-serif;
                font-size: 12px;
                margin-left: 20px;
            }
            h1{
                font-family: "Arial Black", Gadget, sans-serif;
                color: #733119;
            }
            h2{
                color: #BF5D39;
            }
            h3{
                color: #BF5D39;
            }
            #dataEntry{
                display: table;
            }
            #lang{
                display: table-cell;
                width: 400px;
            }
            #out{
                display: table-cell;
                width: 250px;
            }
            aside{
                display: table-cell;
                width: 250px;
            }
        </style>
    </head>
    <body>
        <article>
            <header>
                <h1>Prosty wybór</h1>
            </header>
            <form name=checkRadio>
                <div id="dataEntry">
                    <div id="lang">
                        <section>
                            <h2>Owoce</h2>
                            <label>
                                <input type=checkbox name=fruit value="Jabłko" checked>
                                Jabłko 2zł/kg netto 
                            </label>
                            <input type=number name=price required><br>
                            <label>
                                <input type=checkbox name=fruit value="Gruszka">
                                Gruszka 3zł/kg netto 
                            </label>
                            <input type=number name=price required><br>
                            <label>
                                <input type=checkbox name=fruit value="Winogrono">
                                Winogrono 4zł/kg netto 
                            </label>
                            <input type=number name=price required><br>
                            <label>
                                <input type=checkbox name=fruit value="Arbuz">
                                Arbuz 5zł/kg netto 
                            </label>
                            <input type=number name=price required><br>
                            <label>
                                <input type=checkbox name=fruit value="Truskawka">
                                Truskawki 6zł/kg netto
                            </label>
                            <input type=number name=price required>
                        </section>
                    </div>
                    <section>
                        <label>
                        <input type=number name=firstInput>
                        Numer<br>   
                        </label>
                        <label>
                        <input type=email name=secondInput>
                        E-mail<br>   
                        </label>
                        <label>
                        <input type=text name=thirdInput>
                        Imię<br>    
                        </label>
                        <label>
                        <input type=text name=fourthInput>
                        Adres<br>    
                        </label>
                        <label>
                        <input type=text name=sixthInput>
                        Kod pocztowy<br>    
                        </label>
                        <label>
                        <input type=url name=fifthInput>
                        Adres strony<br>    
                        </label>
                        <label>
                        <input type=text name=seventhInput>
                        Nazwa użytkownika<br>    
                        </label>
                        <label>
                        <input type=password name=eighthInput>
                        Hasło<br>    
                        </label>
                    </section>
                </div>
                <section>
                    <div id="out">
                        <fieldset>
                            <legend>Okno danych wyjściowych</legend>
                            <textarea name=outNow rows=10 cols=40></textarea>
                        </fieldset>
                    </div>
                </section>
                <section>
                    <div>
                        <p>
                            <input type=button name=getEm value="Złóż zamówienie"
                                   onClick="FormMaster.resolveForm()">
                        </p>
                    </div>
                </section>
            </form>
        </article>
    </body>
</html>
0

I jaki jest problem? Od razu zaznaczę, że "nie działa" to nie jest opis problemu.

0

problem polega na tym, że nie wiem za bardzo jak dodać do funkcji FormMaster.resolveForm = function() żeby po wcisnięciu przycisku liczyło mi ceny i przekazywało do textarea, ale tylko te które będą zaznaczone w checkbox, bo tak to wysyła wszystko do textarea, ale nie moge wykonac obliczeń. Same obliczenia mają być obliczać tylko zwiększać cenę o podatek VAT (23%) i wyświetlić się pod wyranym produktem, czyli np. zaznaczamy Jabłka które kosztują 2 zł i w textarea wyświetla nam się "Jabłko 2,24 zł" i tyle.

1 użytkowników online, w tym zalogowanych: 0, gości: 1