Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype.html>
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <script>
- function masodfokuegyenlet(a,b,c,x) {
- return a*x*x + b*x + c = 0; }
- function click__() {
- var input_a = parseFloat(document.getElementById("counta").value);
- if (isNaN(input_a)) {
- alert("Hibás input");
- return; }
- var input_b = parseFloat(document.getElementById("countb").value);
- if (isNaN(input_b)){
- alert("Hibás input");
- return;
- }
- var input_c = parseFloat(document.getElementById("countc").value);
- if (isNaN(input_c)){
- alert("Hibás input");
- return;
- }
- var input_x = parseFloat(document.getElementById("countx").value);
- if (isNaN(input_x)){
- alert("Hibás input");
- return;
- }
- var masodfoku = masodfokuegyenlet(input_a,input_b,input_c,input_x);
- document.getElementById("adat").innerHTML = "Eredmény: "; }
- </script>
- <body>
- <p> Írd be az adatokat a másodfokú egyenlet kiszámításához </p>
- <p id="adat">eredmény...még nem történt számolás</p>
- <input id ="counta" placeholder="Add meg az a-t"> </input>
- <input id ="countb" placeholder="Add meg az b-t"> </input>
- <input id ="countc" placeholder="Add meg az c-t"> </input>
- <input id ="countx" placeholder="Add meg az x-t"> </input>
- <button id="demo" onclick="click__()"> Számol </button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement