Advertisement
Guest User

Untitled

a guest
May 27th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. <!doctype.html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. </head>
  6. <script>
  7. function masodfokuegyenlet(a,b,c,x) {
  8. return a*x*x + b*x + c = 0; }
  9. function click__() {
  10. var input_a = parseFloat(document.getElementById("counta").value);
  11. if (isNaN(input_a)) {
  12. alert("Hibás input");
  13. return; }
  14. var input_b = parseFloat(document.getElementById("countb").value);
  15. if (isNaN(input_b)){
  16. alert("Hibás input");
  17. return;
  18. }
  19. var input_c = parseFloat(document.getElementById("countc").value);
  20. if (isNaN(input_c)){
  21. alert("Hibás input");
  22. return;
  23. }
  24. var input_x = parseFloat(document.getElementById("countx").value);
  25. if (isNaN(input_x)){
  26. alert("Hibás input");
  27. return;
  28. }
  29. var masodfoku = masodfokuegyenlet(input_a,input_b,input_c,input_x);
  30. document.getElementById("adat").innerHTML = "Eredmény: "; }
  31. </script>
  32. <body>
  33. <p> Írd be az adatokat a másodfokú egyenlet kiszámításához </p>
  34. <p id="adat">eredmény...még nem történt számolás</p>
  35. <input id ="counta" placeholder="Add meg az a-t"> </input>
  36. <input id ="countb" placeholder="Add meg az b-t"> </input>
  37. <input id ="countc" placeholder="Add meg az c-t"> </input>
  38. <input id ="countx" placeholder="Add meg az x-t"> </input>
  39. <button id="demo" onclick="click__()"> Számol </button>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement