Reply
blah calculations
Old 11-19-2007, 01:38 PM blah calculations
Junior Talker

Posts: 3
Name: Nads
this just isn't happening

i want a script which prompts for the price of a product, then calculates and displays it after it has been reduced by a percentage.

ok so e.g
someone enters 100 in the prompt then that is reduced by 10%

anyone understand me let alone help lol?
Nadia is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-20-2007, 05:39 AM Re: blah calculations
chrishirst's Avatar
Super Moderator

Posts: 15,291
Location: Blackpool. UK
HTML Code:
<script type="text/javascript">
function discount(price, disc) {
return price -(price * (disc/100));
}
var currPrice = prompt("Price",0);

if (currPrice > 0) {
alert("Discounted price = " + discount(currPrice,10));
}

</script>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-21-2007, 02:36 PM Re: blah calculations
adityas's Avatar
Experienced Talker

Posts: 41
Name: Aditya
WOW chrishirst!!!
adityas is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to blah calculations
 

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

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


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


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

 


Page generated in 0.11459 seconds with 12 queries