Javasript

Status
Niet open voor verdere reacties.

weegh

Nieuwe gebruiker
Lid geworden
24 apr 2007
Berichten
4
Mijn naam is ben en ik heb een probleem met mijn javasript ik moet nl van Netto+Btw=bruto komen maar ik snap niet wat ik moet veranderen dus wie kan mij helpen
dit is mijn site
HTML:
<html>
<head>
<title>netto-bruto</title>
</head>
<body>
<script type="text/javascript">
<!--
var netto = prompt(' Nettoprijs=' ,' ');

var btw = (19 / 119 * netto).toFixed(2);
var bruto = (100 / 119 * netto).toFixed(2);

document.write(' netto: '  +  netto  + ' - bruto: '  +  bruto  + ' =  btw:  '  +  btw,"<br>"); 
// -->
</script>
</body>
</html>
 
Laatst bewerkt door een moderator:
HTML:
<script type="text/javascript">
<!--
var netto;
var btw;
var bruto;

netto = prompt("Wat is de nettoprijs","");
btw = (19 / 119 * netto).toFixed(2);
bruto = (100 / 119 * netto).toFixed(2);

document.write(' netto: '  +  netto  + ' - bruto: '  +  bruto  + ' =  btw:  '  +  btw,"<br>"); 
// -->
</script>

Probeer die eens. (Ik weet niet of je de vars ook op deze manier kan noteren)
HTML:
var netto, btw, bruto;
 
Dit is met netto + btw = bruto:
PHP:
<html>
 <head>
  <title>netto + btw = bruto</title>
 </head>
 <body>
  <script type="text/javascript">
   <!--
    var netto = prompt('Nettoprijs=','');
    netto = parseFloat(netto);
    var btw = (19 / 100 * netto).toFixed(2);
    var bruto = (119 / 100 * netto).toFixed(2);
    netto = netto.toFixed(2);
    document.writeln('netto: ' + netto + ' + btw: ' + btw + ' = bruto: ' + bruto); 
   // -->
  </script>
 </body>
</html>
:)


Vr.Gr. Egel.
 
Tja had al niet verwacht dat mijn code goed zou zijn maar ik had het voorbeeld van de TS gebruikt waar dus ook netto + bruto staat:)
 
javascript

Dit is met netto + btw = bruto:
PHP:
<html>
 <head>
  <title>netto + btw = bruto</title>
 </head>
 <body>
  <script type="text/javascript">
   <!--
    var netto = prompt('Nettoprijs=','');
    netto = parseFloat(netto);
    var btw = (19 / 100 * netto).toFixed(2);
    var bruto = (119 / 100 * netto).toFixed(2);
    netto = netto.toFixed(2);
    document.writeln('netto: ' + netto + ' + btw: ' + btw + ' = bruto: ' + bruto); 
   // -->
  </script>
 </body>
</html>
:)


Vr.Gr. Egel.
 
Dit is met netto + btw = bruto:
PHP:
<html>
 <head>
  <title>netto + btw = bruto</title>
 </head>
 <body>
  <script type="text/javascript">
   <!--
    var netto = prompt('Nettoprijs=','');
    netto = parseFloat(netto);
    var btw = (19 / 100 * netto).toFixed(2);
    var bruto = (119 / 100 * netto).toFixed(2);
    netto = netto.toFixed(2);
    document.writeln('netto: ' + netto + ' + btw: ' + btw + ' = bruto: ' + bruto); 
   // -->
  </script>
 </body>
</html>
:)


Vr.Gr. Egel.
 


egel bedankt voor de oplossing ik ben er erg blij mee:
 
Graag gedaan! :)

Misschien is dit ook wel handig:
PHP:
<html>
 <head>
  <title>netto + btw = bruto</title>
  <script type="text/javascript">
   <!--
    // Egel 070427 ;)
    function calcNetto(netto) {
     netto  = parseFloat(netto);
     document.f.btw.value = (19 / 100 * netto).toFixed(2);
     document.f.bruto.value = (119 / 100 * netto).toFixed(2);
     };
    function calcBtw(btw) {
     btw = parseFloat(btw);
     document.f.netto.value = (100 / 19 * btw).toFixed(2);
     document.f.bruto.value = (119 / 19 * btw).toFixed(2);
     };
    function calcBruto(bruto) {
     bruto = parseFloat(bruto);
     document.f.netto.value = (100 / 119 * bruto).toFixed(2);
     document.f.btw.value = (19 / 119 * bruto).toFixed(2);
     };
   // -->
  </script>
 </head>
 <body style="font: bold 13px 'Verdana';">
  <form name="f">
   Netto: <input type="text" size="8" name="netto" onkeyup="calcNetto(this.value)"> +
   Btw: <input type="text" size="8" name="btw" onkeyup="calcBtw(this.value)"> =
   Bruto: <input type="text" size="8" name="bruto" onkeyup="calcBruto(this.value)">
  </form>
 </body>
</html>
zo heb je drie invulvakjes, als je er één invult passen de andere twee zich aan. :)


Vr.Gr. Egel.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan