Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
how do I do calculations
Old 10-03-2005, 12:20 AM how do I do calculations
Novice Talker

Posts: 6
Trades: 0
I am new to most of this but how do I do calculations within form fields on a page. For example ..Line one field gets multiplied or divided by line 2 field...etc etc....then some way to output a result or total. I have no idea how to do this but I would appriciate any advice on how exactly to do it on a web page.
bayala13 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-03-2005, 12:33 AM
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
You will probably need to use something like a javascript code to do this. You might google javascript calculators or something similar to that.
angele803 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 12:36 AM
Novice Talker

Posts: 6
Trades: 0
java will run within the webpage right?..or will it need a module or something to run it?
bayala13 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 12:42 AM
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
"Java" wont just run, but "javascript" will run fine in all the main browsers today. I know they sound almost identical, but there is a difference between Java and Javascript. Java is an actual programming language, while javascript is a simple scripting language made for the web. You might post your question in the Javascript section of this forum. Someone there might know a script to do this. I dont know a whole lot about javascript, but this doesnt sound like it would be too hard to do, so I think you will get some help in that section.
angele803 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 12:43 AM
Novice Talker

Posts: 6
Trades: 0
Nothing on google seems to be what I need..I wil need to customize the fields myself...with this be difficult and is there any programs that will help?
bayala13 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 12:44 AM
Novice Talker

Posts: 6
Trades: 0
I will try going there...thanks
bayala13 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 02:34 AM
Extreme Talker

Posts: 169
Trades: 0
THere are lot of javascripts available on the net if you don't want to write your own. You may find your script at http://www.dynamicdrive.com/
__________________

Please login or register to view this content. Registration is FREE

TOP 10 WEB HOSTS COMPARED

BEST RESELLER HOSTING
john551 is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 10:23 AM
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
Trades: 0
Dynamicdrive details mostly dhtml, which is a mix and match of html and javascript.

If you have no real clue to what javascript, java, etc are all about, then I suggest you google a javascript tutorial site or better yet, get a free e-book or buy a javascript for dummies.
__________________

Please login or register to view this content. Registration is FREE
- Tumblog with thoughts, quotes, links, videos, images and my creations.

Please login or register to view this content. Registration is FREE
- The best free web browser.

Please login or register to view this content. Registration is FREE
- Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 10-03-2005, 02:27 PM
robsmith's Avatar
Skilled Talker

Posts: 50
Location: UK
Trades: 0
The function below is your javascript, put this between your HEAD tags on your page. It simply takes the 'units' box on your form and multiplies it by the 'rate box'. Then it displays the result in the 'total' box. if you want to change it to addition, just change the line of code to
var Total = Units + Rate etc...

Below that is the form already set up to run the function when you change a value in the boxes


<script javascript>
function DoMath(){
var Units = document.frmData.Units.value
var Rate = document.frmData.Rate.value
var Total = Units * Rate
document.frmData.Total.value = Total
}

</script>



<body>
<form name="frmData" method="POST" >
Units:<br>
<input type="text" onchange="DoMath()" name="Units" size="20"></p>
<p>Rate:<br>
<input type="text" onchange="DoMath()" name="Rate" size="20"></p>
<p>Total:<br>
<input type="text" name="Total" size="20"><br>
<input type="button" onclick="DoMath()" value="Update" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
robsmith is offline
Reply With Quote
View Public Profile
 
Old 10-03-2005, 02:28 PM
purk's Avatar
Extreme Talker

Posts: 164
Name: James
Location: marbella & surrey
Trades: 0
you could try summit like

function whatever(){
result = document.getElementById('UR_INPUT_ELEMENT_1').valu e + document.getElementById('UR_INPUT_ELEMENT_2').valu e
}

or summit to that effect - btw. i'm no js coder by any means.

;purk
purk is offline
Reply With Quote
View Public Profile Visit purk's homepage!
 
Reply     « Reply to how do I do calculations
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47420 seconds with 12 queries