Making the Client script for solving the Quadratic Equation in the web from for any doctype

I made doctype to solve the quadratic equation and want to write a script for the following in the web form taking input from user as A = ?
B = ? C = ? and giving answer as Root1 and Root2
What could be the script for that