Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
lehrkraefte:blc:informatik:efi-2023:js [2024/04/25 11:07] Ivo Blöchliger |
lehrkraefte:blc:informatik:efi-2023:js [2024/04/25 12:00] (current) Ivo Blöchliger |
||
---|---|---|---|
Line 12: | Line 12: | ||
[[https:// | [[https:// | ||
+ | |||
+ | ====== Temperatur-Rechner ====== | ||
+ | |||
+ | <code html> | ||
+ | Grad Celsius <input type=" | ||
+ | Grad Fahrenheit <input type=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | window.addEventListener(' | ||
+ | let grad = this.document.getElementById(' | ||
+ | let fahrenheit = this.document.getElementById(' | ||
+ | |||
+ | function c2f() { | ||
+ | let f = Number(grad.value)*1.8+32; | ||
+ | fahrenheit.value=f; | ||
+ | console.log(`Die Umrechnung gibt ${f}`); | ||
+ | } | ||
+ | |||
+ | grad.addEventListener(' | ||
+ | |||
+ | function f2c() { | ||
+ | let c = (Number(fahrenheit.value)-32)/ | ||
+ | grad.value=c; | ||
+ | console.log(`Die Umrechnung gibt ${c}`); | ||
+ | } | ||
+ | fahrenheit.addEventListener(' | ||
+ | |||
+ | }); | ||
+ | </ |