Source: Internet
Author: User

Online One-yuan two formula calculator instance share, everybody reference use bar

Code as follows: <html> <head> <meta http-equiv= "Content-type" content= "text/html" charset= "Utf-8" > < title> Online unary two formula calculator </title> </head> <body> <form name= "Fquad" > <p align= " Center "> Solution two times equation calculation <br> </p> <table align=" center "> & nbsp <tbody> <tr> <TD bgcolor= "#990000" > <h2><font color= "#ff FFFF "><input size=" 4 "name=" FA "type=" text "> x<sup>2</sup>+ <input size=" 4 "name=" FB "type=" Text "> x + <input size=" 4 "name=" FC "type=" text "> = 0 <input onclick=" Checkquad () "type=" button "value=" Problem Solving " ; <input type= "reset" value= "reset" > </font></h2> ;p align= "center" ><font Color= "#ffffff" face= "Arial" ><b> solution to the two-time equation </b></font></p> </td> </tr> <tr> <TD bgcolor= "#990000" > &NBSP ; <h2><font color= "#ffffff" >x<sub><a style= "text-decoration: None "><font color=" #ffffff ">1</font></a></sub>=<input size=" name= "x1" type= "text "> <br> x<sub>2</sub>=<input size=" "Nam E= "X2" type= "text" > </font></h2> </td> </tr> <tr> </tr> &nbsP </tbody> </table> </form> <p align= "center" >made by croot</ p> <script language= "JavaScript" > <!-- var Rootparti; var Rootpart; var det; var rootparti1; var Rootparti2; var A; var b; var C; var X1; var X2; var i = "I"; function Checkquad () {var a = Document.fquad.fa.value; var b = Document.fquad.fb.value; var c = document.fquad.fc.value; if (a = = 0 && C!= 0) {x1 =-c/b; x2 = "Not a quadratic equation, but this is your answer to for X"; Document.fqua d.x1.value=x1; document.fquad.x2.value=x2; else if (a = = "" && C!= 0) {x1 =-c/b; x2 = "Not a quadratic equation"; document.fquad.x1.value=x1; document.fquad.x2.value=x2; else {quad (); &NBSP}} function Quad () {var a = Document.fquad.fa.value; var b = Document.fquad.fb.value; var c = Document.fquad.fc.value; Det = Math.pow (b,2)-4 * A * C; Rootpart = math.sqrt (det)/(2 * a); Rootparti = (math.sqrt (-det)/(2 * a)) + I; if (Parsefloat (Rootparti) < 0) {rootparti1 = Rootparti; rootparti2 = ( -1 * parsefloat (Rootparti)) + I;} else {Rootparti1 = ( -1 * parsefloat (Rootparti)) + i; Rootparti2 = Rootparti; } if (rootparti1 = = "1i") {rootparti1 = i; rootparti2 = "I";} else if (rootparti1 = = " -1i") {rootparti1 = "I"; rootpa Rti2 = i; } if (Det = = 0) {x1 = x2 =-B/(2 * a);} else if (Det > 0) {x1 = (b + math.sqrt (DET))/(2 * a); x2 = (-B-MATH.S QRT (DET))/(2 * a); else if ((b/(2 * a)) = = 0) {x1 = rootparti1; x2 = rootparti2;} else {x1 = (-b/(2 * a) + "+" + rootparti1); x2 = (b/(2 * a) + "+" + Rootparti2);} document.fquad.x1.value=x1; document.fquad.x2.value=x2; /would solve for complex numbers // --> </script> </body> </html>
Related Article