[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-16-2008, 12:35 PM   #1 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


Help! profit calculator

hello

can anyone point me in the right direction? searched google but no luck
what i need:

a profit calculator to:
Ex: people can calculate their profit for selling stuff.
Number of people: 20
Number of dvds: 10
Number of books: 10

Total profit 12000$

now here is the math: when they add 10 dvds this will be multiplied with 32$
when they add 10 books it will be multiplied with 28$
so 32*10=320$+280$(10*28)=600$ * 20people=12000$

Can someone tell me?thanks
tanicos is offline  
Old 07-16-2008, 12:43 PM   #2 (permalink)
NamePros Regular
 
Join Date: Apr 2008
Posts: 546
1,314.10 NP$ (Donate)

srigopaldaliya has a spectacular aura aboutsrigopaldaliya has a spectacular aura aboutsrigopaldaliya has a spectacular aura about


U just need to make an excel sheet with proper formulaes thats it.. No need to seperate tool to do this stuff.....
srigopaldaliya is offline  
Old 07-16-2008, 12:45 PM   #3 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


hello

i need it on a website page
tanicos is offline  
Old 07-16-2008, 01:08 PM   #4 (permalink)
NamePros Member
 
Join Date: Sep 2006
Posts: 87
100.00 NP$ (Donate)

Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough


Code:
<html>
<head>

<script type='text/javascript'>
function calc() {

  var cost_dvd = 32;
  var cost_book = 28;

  document.getElementById('total').innerHTML = Math.floor(document.getElementById('people').value) * (Math.floor(document.getElementById('dvds').value) * cost_dvd + Math.floor(document.getElementById('books').value) * cost_book);
}
</script>

</html>

<body>

People: <input type='text' size='3' id='people' onkeyup='calc();' value='0' /><br />
DVDs: <input type='text' size='3' id='dvds' onkeyup='calc();' value='0' /><br />
Books: <input type='text' size='3' id='books' onkeyup='calc();' value='0' /><br /><br />
Total: $<span id='total'>0</span>


</body>
</html>

Bruce
Bruce_KD is offline  
Old 07-16-2008, 03:35 PM   #5 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


Cool

Quote:
Originally Posted by Bruce_KD
Code:
<html>
<head>

<script type='text/javascript'>
function calc() {

Bruce
i can't thank you enough...is there a way to add a button which says calculate instead of automatic result? thanks a lot
tanicos is offline  
Old 07-16-2008, 03:54 PM   #6 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


take out the onkeyup="calc();" from the 3 <input>s and add an <button onclick="calc();> and you SHOULD get the same result, except on button click.
nasaboy007 is offline  
Old 07-16-2008, 03:58 PM   #7 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


Thumbs up

Quote:
Originally Posted by nasaboy007
take out the onkeyup="calc();" from the 3 <input>s and add an <button onclick="calc();> and you SHOULD get the same result, except on button click.
thank you very much too
tanicos is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:17 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85