??? 07/07/12 00:48 Read: times |
#187875 - MyFirstJavascript calculator!! Responding to: ???'s previous message |
Hi Per,
So have been spending some time on the net trying to learn how to say "HelloWorld" in JS. Looks not very difficult as I could write the code below rather fast ( OK adapted it from an example - ). I now want to bring in a Option button for English / Metric units and based on the selection do the relevant calculation. I am sure thats going to be possible too ?? <html> <head> <title> Fluid Power Calculator </title> <script language="javascript" type="text/javascript"> function findvelocity(){ a=Number(document.calculator.number1.value); b=Number(document.calculator.number2.value); c=((a*1000/60)/ ((b/10)^2 *0.785))*10; document.calculator.total.value=c; } </script> </head> <body> <!-- Opening a HTML Form. --> <form name="calculator"> <p> <!-- Here user will enter 1st number. --> Flow (lpm) : <input type="text" name="number1"> </p> <p> <!-- Here user will enter 2nd number. --> Pipe ID (mm): <input type="text" name="number2"> </p> <p> <!-- Here result will be displayed. --> Velocity ( mm/sec): <input type="text" name="total"> </p> <!-- Here respective button when clicked, calls only respective artimetic function. --> <input type="button" value="CALCULATE" onclick="javascript:findvelocity();"> </form> </body> </html> For those not very familiar with HTML : To try the code, just copy paste the code into notepad and save it as a html file. Double click and it opens in a IE9 browser ( or any browser ?)and even calculates !! Raghu |
Topic | Author | Date |
Publishing a Excel file on website | 01/01/70 00:00 | |
Excel is not a web standard! | 01/01/70 00:00 | |
Javascript | 01/01/70 00:00 | |
The WikiLink | 01/01/70 00:00 | |
Extra ")" | 01/01/70 00:00 | |
MyFirstJavascript calculator!! | 01/01/70 00:00 | |
Always break problem into smaller pieces | 01/01/70 00:00 | |
Just let them download it | 01/01/70 00:00 | |
Download or run on site? | 01/01/70 00:00 | |
Applet? | 01/01/70 00:00 | |
Applet | 01/01/70 00:00 | |
So - you don't care about electronic terms either? | 01/01/70 00:00 | |
That's the orangest bushel of apples I've ever seen. | 01/01/70 00:00 | |
Try the Google Approach | 01/01/70 00:00 | |
Making my requirememt more clear... | 01/01/70 00:00 | |
That's a different problem - not a clarification! | 01/01/70 00:00 | |
Excel dead end? | 01/01/70 00:00 | |
People can, if they need, use OpenOffice ... right? | 01/01/70 00:00 |