MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus InDiGuD-Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 6: Zeile 6:
   const f3 = 0.3400;
   const f3 = 0.3400;
   
   
   copa = document.getElementById('copa-7w35');
   copa = document.getElementById('copa-7w35').value;
   copb = document.getElementById('copa2w35');
   copb = document.getElementById('copa2w35').value;
   copc = document.getElementById('copa7w35');
   copc = document.getElementById('copa7w35').value;


   scop = 1.00000 / ( (f1 / copa) + (f2 / copb)  + (f3 / copc ) );
   scop = 1.00000 / ( (f1 / copa) + (f2 / copb)  + (f3 / copc ) );

Version vom 16. April 2024, 18:53 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */
 function scopCalculator() {
   var copa, copb, copc, scop;
   const f1 = 0.0380;
   const f2 = 0.5250;
   const f3 = 0.3400;
 
   copa = document.getElementById('copa-7w35').value;
   copb = document.getElementById('copa2w35').value;
   copc = document.getElementById('copa7w35').value;

   scop = 1.00000 / ( (f1 / copa) + (f2 / copb)  + (f3 / copc ) );

   document.getElementById('scop').innerHTML = scop.toFixed(3);
}
 
 $(function () {
   if ($('#scop-wrapper').length) {
       document.getElementById('scop-wrapper').innerHTML =
       '<p>COP-Wert A-7/W35:</p>' + 
       '<input id="copa-7w35" type="number" style="width: 130px">' +
       '<p>COP-Wert A2/W35:</p>' +
       '<input id="copa2w35" type="number" style="width: 130px">' +
       '<p>COP-Wert A7/W35:</p>' +
       '<input id="copa7w35" type="number" style="width: 130px">' +       
       '<br />' +
       '<button type="button" onclick="scopCalculator()">Berechnen</button>' +
       '<p><a id="scop">0</a></p>';
   }
 });