this is a currency converter i created for my Certificate IV in web design. it works 100%
the code is free to use , just change the currency and the country names. and if ur smart enough try and find a way to add the % icon into the bank commission box.
thnks and have fun with the code ...........
| JavaScript |
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
</style><h1 align="center">
Australian dollar (AUD) Currency Converter
</h1>
<title>Currency Converter</title>
<script type="text/javascript">
var strCurrency=['U.S$','NZ$','€','Y','S$','HK$'];
var dblRate=[0.93, 1.26, 7.14, 1.34, 1.15, 6.29];
function convertCurrency(f){
txtS = f['txtSterling'];
var selC = f['selCurrency'];
var txtC = f['txtConversion'];
var txtD = f['Conversion'];
txtC.value = txtS.value;
if(isNaN(txtS.value)){
txtS.value='0.00';
return 0;
}else{
if(txtS.value <= 200) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]); }
if(txtS.value <= 500 && txtS.value > 200) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]); }
if(txtS.value >= 1000) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]); }
txtC.value = strCurrency[selC.selectedIndex] + numberFormat(txtC.value) ;
}
}
function numberFormat(number)
{
return (Math.round(number * 100) / 100);
}
function convertTotal(f){
txtS = f['txtSterling'];
var selC = f['selCurrency'];
var txtC = f['txtTotal'];
var txtD = f['Conversion'];
txtC.value = txtS.value;
if(isNaN(txtS.value)){
txtS.value='0.00';
return 0;
}else{
if(txtS.value <= 200) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]) + 20; }
if(txtS.value <= 500 && txtS.value > 200) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]) + 30; }
if(txtS.value >= 1000) { txtC.value = numberFormat(parseFloat(txtC.value) * dblRate[selC.selectedIndex]) + 40; }
txtC.value = strCurrency[selC.selectedIndex] + numberFormat(txtC.value) ;
}
}
function numberFormat(number)
{
return (Math.round(number * 100) / 100);
}
function convertCommision(f){
txtS = f['txtSterling'];
var selC = f['selCurrency'];
var txtC = f['txtComm'];
var txtD = f['Conversion'];
txtC.value = txtS.value;
if(isNaN(txtS.value)){
txtS.value='0.00';
return 0;
}else{
if(txtC.value <= 100) { txtC.value = numberFormat(parseFloat( + 20)); }
if(txtC.value >= 500 && txtC.value <= 1000) { txtC.value = numberFormat(parseFloat( + 30)); }
if(txtC.value >= 1001) { txtC.value = numberFormat(parseFloat( + 40)); }
txtC.value = numberFormat(txtC.value) ;
}
}
function numberFormat(number)
{
return (Math.round(number * 100) / 100);
}
</script>
</head>
<body>
<td>
<form action="" align="center" valign="top">
<div align="center">$ AUD
<input type="text" name="txtSterling" onBlur="convertCurrency(this.form)">
<select name="selCurrency">
<option>U.S.A</option>
<option>New Zealand</option>
<option>UK</option>
<option>Japanese</option>
<option>Singapore</option>
<option>Hong Kong</option>
</select>
<input type="button" value="Rate" name="cmdCurrency" onClick="convertCurrency(this.form)">
<input type="text" name="txtConversion" readonly="readonly">
<input type="button" value="Toatal" name="cmdTotal" onClick="convertTotal(this.form)">
<input type="text" name="txtTotal" readonly="readonly">
<input type="button" value="Commision" name="cmdComm" onClick="convertCommision(this.form)">
<input type="text" name="txtComm" readonly="readonly">
</div>
</form>
</Td>
</body>
</html>
|


Comments
This Currency Converter is (c)2008 By Jonathan Fenech
Sign in to comment