MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus InDiGuD-Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:
  function scopCalculator() {
  function scopCalculator() {
   var copa, copb, copc, scop;
   var copa, copb, copc, scop;
   const f1 = 0.038;
   const f1 = 0.0380;
   const f2 = 0.525;
   const f2 = 0.5250;
   const f3 = 0.340;
   const f3 = 0.3400;
   
   
   copa = document.getElementById('copa-7w35').value;
   copa = document.getElementById('copa-7w35');
   copb = document.getElementById('copa2w35').value;
   copb = document.getElementById('copa2w35');
   copc = document.getElementById('copa7w35').value;
   copc = document.getElementById('copa7w35');


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


   document.getElementById('scop').innerHTML = scop.toFixed(3);
   document.getElementById('scop').innerHTML = scop.toFixed(3);

Version vom 16. April 2024, 18:51 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');
   copb = document.getElementById('copa2w35');
   copc = document.getElementById('copa7w35');

   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>';
   }
 });