Discussion Forums  >  Uncategorized

Replies: 7    Views: 388

Racer X
buzztouch Evangelist
Profile
Posts: 129
Reg: Mar 24, 2011
Boston, MA
5,490
05/17/11 05:40 PM (14 years ago)

Sample basic math HTML Code

Could anyone provide an example line of HTML for division. For example I want the use to enter a number and that number be divided by another number. But I am new to HTML and cant seem to locate it on the net. Any help is much appreciated. I am trying to make a simple calculation with a custom HTML screen. I see how easy it is to make the screen, just cant figure out the basic math HTML coding.
 
TheHoogler
I hate code!
Profile
Posts: 152
Reg: Feb 10, 2011
Anchorage, AK
1,520
like
05/17/11 05:47 PM (14 years ago)
Have you tried looking up html widgets? It should be easy to find a premade calculator (if that's what you need). For instance... http://www.htmlfreecodes.com/Calculator_in_your_page.htm
 
Racer X
buzztouch Evangelist
Profile
Posts: 129
Reg: Mar 24, 2011
Boston, MA
5,490
like
05/17/11 05:52 PM (14 years ago)
I did actually. But instead of an entire calculator I am just looking to divide one box (user entered) by another box (user entered).
 
TheHoogler
I hate code!
Profile
Posts: 152
Reg: Feb 10, 2011
Anchorage, AK
1,520
like
05/17/11 06:22 PM (14 years ago)
hopefully you'll find an html wizard on here :)
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
05/17/11 09:47 PM (14 years ago)
There is probably a more elegant way of doing this (I just learned basic HTML tonight). Let me know if you have any questions: <html> <head> <script type=text/javascript> </script> </head> <body> <form name=Division> Enter Dividend <input type=text name=dividend><br> Enter Divisor<input type=text name=divisor><br> <button type=button onclick= document.Division.quotient.value = parseFloat(document.Division.dividend.value)/parseFloat(document.Division.divisor.value)>Compute</button><br> Quotient <input type=text name=quotient DISABLED> </form> </body> </html>
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
05/17/11 09:58 PM (14 years ago)
you'll need to put quotes around document.Division.quotient.value = parseFloat(document.Division.dividend.value)/parseFloat(document.Division.divisor.value) & Division in <form name=Division>
 
Racer X
buzztouch Evangelist
Profile
Posts: 129
Reg: Mar 24, 2011
Boston, MA
5,490
like
05/18/11 02:18 PM (14 years ago)
Thanks DanielH!, much appreciated. What did you use to learn HTML so fast?
 
DanielH
Aspiring developer
Profile
Posts: 33
Reg: Jan 24, 2011
location unknow...
330
like
05/18/11 06:41 PM (14 years ago)
I learned by helping my younger brother with some college homework. I googled some examples for help. Thankfully, I have a background in programming (C, C++, verilog, fourtran)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.