Results 1 to 3 of 3

Thread: Currency Convertion

  1. #1
    Join Date
    Oct 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Currency Convertion

    Hi
    In ASP, Have any idea on Currency converstion using with JavaScript?.
    Can you bear a hand to me?
    thanking you
    regards
    rex

  2. #2
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    <table cellpadding=2 style="border:2px outset;background-color:silver;font-size:12px">

    <tr><td class="default_style">Local Currency<br />Amount</td>
    <td><input id="curamount" name="curamount " type=text value=100000 size=8></td></tr>

    <tr><td class="plain_text">Exchange Rate </td>

    <td><input id="exrate" name="exrate" type=text value=1.49 size=8></td></tr>

    <tr> <td></td><td>
    <button

    onclick="getEuros(document.getElementById('curamount').value,document.getElementById('exrate').value)">Calculate</button></td></tr>

    <tr>
    <td colspan=2 align="right">Euro Amount</td></tr>

    <tr><td></td><td><input type=text id="euros" name="euros" size=8></td></tr>
    </table>


    <script type="text/javascript">
    <!--
    function getEuros(camount,xrate) {

    if (camount<=0 || xrate<=0 )
    {
    alert ("The fields must contain positive numbers!");
    return 0;
    }
    if (NotNumeric(camount) || NotNumeric(xrate))
    {alert("Fields can only contain numbers");
    return 0;}



    var acc=0;

    acc = Math.round(camount*xrate*100)/100;

    document.getElementById('euros').value=acc;

    return camount;
    }
    function NotNumeric(ss){

    var charpos = ss.search("[^0-9]");
    if(ss.length > 0 && charpos == 0){return true;}
    return false;
    }
    //-->
    </script>

    Hope this helps
    Cheers
    Billy

  3. #3
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I know that Javascript can not read contents of a file. I can't think of an elegant JavaScript solution, apart from using frames. Maybe an expert will have to help you here.
    Last edited by hazeline03; 07-21-2010 at 03:19 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •