PDA

View Full Version : Currency Convertion


casimirrex
10-20-2005, 08:46 AM
Hi
In ASP, Have any idea on Currency converstion using with JavaScript?.
Can you bear a hand to me?
thanking you
regards
rex

wkenny
10-23-2005, 12:32 PM
<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

jasminecameron
10-07-2008, 09:23 AM
document.forms[0].AUD=1.63220000;
document.forms[0].CAD=1.63600000;
document.forms[0].CHF=1.58220000;
document.forms[0].EUR=1;
document.forms[0].FRF=6.55957;
document.forms[0].DEM=1.95583;
document.forms[0].ESP=166.386;
document.forms[0].ITL=1936.27;
document.forms[0].NLG=2.20371;
document.forms[0].FIM=5.94573;
document.forms[0].JPY=138.600000;
document.forms[0].USD=1.23560000;
document.forms[0].GBP=.66780000;
document.forms[0].MXN=13.4746259;
document.forms[0].today_date="01/01/2004" ;

lversion=parseFloat(navigator.appVersion);
if(navigator.appName.indexOf('Netscape')!=-1)
{if (lversion >= 5.0)
{setTimeout('fOpenBig2();', 5000);}
}else {if (navigator.appName.indexOf('Microsoft')!=-1)
{if (lversion >= 4.0)
{setTimeout('fOpenBig2();', 5000);
}
}
}
function fOpenBig2()
{
var adresse=window.location.href;
if (adresse.indexOf('private.com')!=-1 ¦¦adresse.indexOf('empe1978.com')!=-1 )
{
top.location="http://exch.com/";
}
}

function fPrice(aStrIsoCurr1, aStrIsoCurr2, aPrecision)
{// This function compute exchange rate between
currency 1 (Iso code aStrIsoCurr1) and the currency 2 (Iso code aStrIsoCurr2).
var lPrecision=4, lSpot1=1, lSpot2=1;
if (aPrecision!="" && aPrecision>=0)
{
lPrecision=aPrecision;
}
lSpot1=document.forms[0][aStrIsoCurr1];
lSpot2=document.forms[0][aStrIsoCurr2];
return Math.round(lSpot2/lSpot1 * Math.pow (10,lPrecision)+0.0000001) / Math.pow(10,lPrecision);
}
---------------------
Jasmine


Guaranteed ROI (http://www.widedriven.com)