I am trying to find a function that will allow me to take an equation, and post the output in another location. For example. x * y + z = output I need to get the output to display in a certain section of the website. Anybody know a java script function that will do what I need???
Yes you can. Create an div element in the location of output(say, name="myDiv"). On clicking a "get equation result" button call the following function. Hope i have answered your question. If not, do reply.
Hi Please try my script: <html> <head> <title></title> <script language="JavaScript"> <!-- function add() { var num1, num2, num3, total; num1 = parseInt(document.calcForm.num1.value); num2 = parseInt(document.calcForm.num2.value); num3 = parseInt(document.calcForm.num3.value); var sum = (num1*num2)+num3; document.calcForm.output.value = sum; } </script> </head> <body> <form name="calcForm"> <p>Enter the X Factor: <br /><input type="text" name="num1" size="5" align="center"></p> <p>Enter the Y Factor: <br /><input type="text" name="num2" size="5" align="center"></p> <p>Enter the Z Factor: <br /><input type="text" name="num3" size="5" align="center"></p> <p><input type="button" value="Submit" onClick="add()"> <br />( X x Y ) + Z is = <input type="text" name="output"size="10" style="border:0" readonly></p> </body> </html> Code (markup): Hope it can help you