Saturday, November 21, 2015

Currency Converter in JavaScript

A simple program that I wrote in JavaScript that will convert currency value into other currencies. The code is very simple and easy to understand.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Sample Program Output


Program Listing

<html>
<body bgcolor="white" >
<font face="comic sans ms">
<script language="JavaScript">
<!--
function euroConverter(){
document.converter.dollar.value = document.converter.euro.value * 1.470
document.converter.pound.value = document.converter.euro.value * 0.717
document.converter.yen.value = document.converter.euro.value * 165.192
}
function dollarConverter(){
document.converter.euro.value = document.converter.dollar.value * 0.680
document.converter.pound.value = document.converter.dollar.value * 0.488
document.converter.yen.value = document.converter.dollar.value * 112.36
}
function poundConverter(){
document.converter.dollar.value = document.converter.pound.value * 2.049
document.converter.euro.value = document.converter.pound.value * 1.394
document.converter.yen.value = document.converter.pound.value * 230.27
}
function yenConverter(){
document.converter.dollar.value = document.converter.yen.value * 0.0089
document.converter.pound.value = document.converter.yen.value * 0.00434
document.converter.euro.value = document.converter.yen.value * 0.00605
}
//-->
</script>
<h3>  Currency Converter 1.0 </h3>
<form name="converter">
<table border="0">
<tr>
<td>Euro: </td><td><input type="text" name="euro" onChange="euroConverter()" /></td>
</tr>
<tr>
<td>US Dollar: </td><td><input type="text" name="dollar" onChange="dollarConverter()" /></td>
</tr>
<tr>
<td>British Pound:</td><td><input type="text" name="pound" onChange="poundConverter()" /></td>
</tr>
<tr>
<td>Japanese Yen: </td><td><input type="text" name="yen" onChange="yenConverter()" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="Convert!" /></td>
</tr>
</table>
</form>

</body>
</html>



No comments:

Post a Comment