Does it ever bother you how much a long-distance phone call is going to cost, after you hung up? With this script, all you have to do is enter the amount per minute, and any initial amount, then click start when the call begins and see the total charge at any time! Save time, money, and learn JavaScript all with this script! :-)
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 86 87 88 89 90 | /******************************************************* * MYCPLUS Sample Code - https://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is provided strictly for the * * purpose of illustration. * * * * Please direct all inquiries to saqib at mycplus.com * *******************************************************/ <!-- TWO STEPS TO INSTALL PHONE BILL: 1. Paste the first code in the HEAD of your HTML document 2. Add the last coding to the BODY of your HTML document --> <!-- STEP ONE: Paste the first code in the HEAD of your HTML document --> <body> <script LANGUAGE="JavaScript"> <!--Total Java Scripts 99 - Next Step Software--> <!-- Begin function decimal(num) { string = "" + num; if (string.indexOf('.') == -1) return string + '.00'; seperation = string.length - string.indexOf('.'); if (seperation > 3) return string.substring(0,string.length-seperation+3); else if (seperation == 2) return string + '0'; return string; } i=0; x=0; countit="yes"; function count() { if (i == 60) { i=0; x=(x + 1)} document.money.minutes.value = x; i++; document.money.seconds.value = i; document.money.owed.value = "$" + decimal((x * document.money.permin.value) + eval(document.money.initial.value)); if (countit != "no") { setTimeout('count()',1000); } } function stop() { countit="no"; } // End --> </script> <!-- STEP TWO: Add the last coding to the BODY of your HTML document --> <body> <form name=money> <table border=1 bgcolor="#f5f5f5"> <tr> <td>Initial amount added to every call:</td> <td> <input name=initial type=text value="1.25" size=20 onChange="document.money.owed.value = decimal(document.money.initial.value)"></td> </tr> <tr> <td>Amount per minute:</td> <td><input name=permin type=text value=".10" size=20></td> </tr> <tr> <td>Number of minutes passed:</td> <td><input name=minutes type=text size=20></td> </tr> <tr> <td>Seconds in current minute:</td> <td><input name=seconds type=text size=20></td> </tr> <tr> <td>Amount of phone call:</td> <td><input name=owed type=text size=20 value="$0.00"></td> </tr> <tr> <td colspan=2 align=center><input type=button value=" Start " onClick="countit='yes'; count()"><input type=button value=" Stop " onClick="stop()"></td> </tr> </table> </form> <!-- Script Size: 2.04 KB --> |