Read stories by different users


Liangs Website by Liang
Liang

<!DOCTYPE html> <html> <head> <title>Alegebra Calculator</title> </head> <body> <form name="alegebra_form" id="alegebra_form"> <input type="text" name="value" id="value"><br /> <input type="text" name="variable" id="variable"> </form> <p>Click the button to locate where in the string a specifed value occurs.</p> <button onclick="calculate()">Try it</button> <p id="demo"></p> <script type="text/javascript"> function calculate() { var equation = document.getElementById('value').value; var check = document.getElementById('value').value; var variable = document.getElementById('variable').value; equation=equation.split("="); e quation.indexOf("-"); equation.indexOf("+"); equation.indexOf("*"); equation.indexOf("x"); equation.indexOf("X"); equation.indexOf("/"); var value = equation.replace(" ", ""); value = value.replace(variable, ""); value = Number(value) if(equation.indexOf("-")!=-1){ answer = value } document.getElementById('demo').innerHTML=equation[0]+equation[1]; } < ;/script> </body> </html>


Please Login to post a comment