37 users online (1 members and 36 guests)  


  Results 1 to 4 of 4

Related

  1. Stuck in CSS!    Forum: CSS Forum
    Replies: 3
  2. Stuck on mySQL!    Forum: Databases
    Replies: 5
  3. I'm stuck on my website- regarding MP3 downloads    Forum: General Discussion
    Replies: 2
  1. #1
    ssb's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    3

    Question Need help...stuck!!!

    I have implemented a document and added a form to it so that i can convert an amount of money between British pounds and US dollars.

    I am trying to extend the above to charage a commission of 5% of the value of the amount changed in the currency that the money is being changed from.

    Im really stuck can someone help...thanx

  2. #2
    Enigma's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Nov 2000
    Posts
    426
    Can you post a URL or some code?

  3. #3
    ssb's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2003
    Posts
    3

    This is the code...

    <html>
    <head>
    <title>currency converter</title>

    <script language="javascript">
    <!--

    var exchRate = 1.6; // constant

    function calc(form){

    var usdValue = form.USD.value;
    var gbpValue = form.GBP.value;

    //strip dollar or pound signs:

    if (usdValue.substring(0,1) == '$') {
    usdValue = form.USD.value = usdValue.substring(1);
    }

    if ((gbpValue.substring(0,1) == '#') or (gbpValue.substring(0.1) == "")) {
    gbpValue = form.GBP.value = gbpValue.substring(1);
    }

    if (Number(usdValue)) {
    // a number has been typed in the USD field
    form.GBP.value = ( Number(form.USD.value)/exchRate);
    return;
    }

    if (Number(gbpValue)){
    // a number has been typed in the GBP field
    form.USD.value = (Number(form.GBP.value)*exchRate);
    return;
    }

    }

    //-->
    </head>
    </script>

    <body>

    <form name="tool">
    Enter Currency to convert in desired field:

    <br>

    USD ($): <input type="text" size=8 name="USD">

    <br>

    GBP (): <input type="text" size=8 name="GBP">

    <br>

    <input type="button" value="calculate" onclick="calc(this.form)">

    <br>

    <input type="reset" value="reset">
    </form>
    </body>
    </html>

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Is the charge added on to the total, or deducted the the returned value?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread