Simple JavaScript Currency Converter | Currency Converter using JavaScript

In this tutorial, we will create a Simple Currency Converter using Javascript. I'm trying to make a currency converter that converts between several different currencies on change. It uses some pre-determined exchange rates. JavaScript is a scripting or programming language that allows you to implement complex things on web pages. In this program, you will learn how Currency Converter using JavaScript. So, let start the Simple JavaScript Currency Converter.



Currency Converter using JavaScript
Currency Converter using JavaScript





JavaScript Currency Input:

<html>
<head>

<!-- *****************start css part***************** -->
<style>
body
{
width:400px;

border:1px solid white;

position:absolute;

top:150px;
left:100px;
background-color:black;
color:white;
}

</style>
<!-- *****************end css part***************** -->



<!-- *****************start javascript part***************** -->
<script>
function check(){
var a,b,c,result;
b=Number(document.getElementById("selec").value);
c=Number(document.getElementById("selec2").value);
a=Number(document.getElementById("a").value);
if(b==c)
{
alert("You have entered Two Same country: Please try again!!!");
}
else
{
switch (b)
{

<!-- *****************start case 1***************** -->
case 1:
{
if(b==1 && c==2)
{
result=83.70*a;
}
else if(b==1 && c==2)
{
result=64.94*a;
}
else if(b==1 && c==3)
{
result=112.11*a;
}
else if(b==1 && c==4)
{
result=0.85*a;
}
else if(b==1 && c==5)
{
result=0.85*a;
}
break;
}
<!-- *****************end case 1***************** -->



<!-- *****************start case 2***************** -->
case 2:
{
if(b==2 && c==1)
{
result=0.01*a;
}
else if(b==2 && c==3)
{
result=0.78*a;
}
else if(b==2 && c==4)
{
result=1.34*a;
}
else if(b==2 && c==5)
{
result=0.01*a;
}
break;
}
<!-- *****************end case 2***************** -->



<!-- *****************start case 3***************** -->
case 3:
{
if(b==3 && c==1)
{
result=0.02*a;
}
else if(b==3 && c==2)
{
result=1.29*a;
}
else if(b==3 && c==4)
{
result=1.73*a;
}
else if(b==3 && c==5)
{
result=0.01*a;
}
break;
}
<!-- *****************end case 3***************** -->



<!-- *****************start case 4***************** -->
case 4:
{
if(b==4 && c==1)
{
result=0.01*a;
}
else if(b==4 && c==2)
{
result=0.75*a;
}
else if(b==4 && c==3)
{
result=0.58*a;
}
else if(b==4 && c==5)
{
result=0.01*a;
}
break;
}
<!-- *****************end case 4***************** -->



<!-- *****************start case 5***************** -->
case 5:
{
if(b==5 && c==1)
{
result=1.18*a;
}
else if(b==5 && c==2)
{
result=98.69*a;
}
else if(b==5 && c==3)
{
result=76.57*a;
}
else if(b==5 && c==4)
{
result=132.20*a;
}
break;
}
<!-- *****************end case 5***************** -->


}
}
document.getElementById("answer").value=result;
}
</script>
<!-- *****************end javascript part***************** -->




</head>
<body>
<center>
Enter Your Currency Amount:<br>
<input type="number" id="a" placeholder="00.00">
<br><br>
Select Your Currency Country:<br><select id="selec">
<option value="0">-------</option>
<option value="1">America</option>
<option value="2">Bangadesh</option>
<option value="3">India</option>
<option value="4">Japan</option>
<option value="5">Franch</option>
</select><br><br>
Chose The Converter Country:<br><select id="selec2">
<option value="0">-------</option>
<option value="1">America</option>
<option value="2">Bangadesh</option>
<option value="3">India</option>
<option value="4">Japan</option>
<option value="5">Franch</option></select><br><br>
          <input type="button" onclick="check()" value="Convert"></button>
  <br>The Converted Amount is:<br>
<input type="number" id="answer" placeholder="00.00">
</center>
</body>
</html>



Currency Converter Output:


Simple JavaScript Currency Converter
Simple JavaScript Currency Converter 




Simple JavaScript Currency Converter
Simple JavaScript Currency Converter 



Post a Comment

11 Comments

  1. At the point when is the best time to trade currency
    convert money online

    ReplyDelete
  2. In the short list converter, just the significant monetary standards are reflected, so this converter is best for worldwide brokers since all monetary forms are not much of the time exchanged.convert money calculator

    ReplyDelete
  3. . This will give you the best venture system for your cash that you hazard. Aussie trading account

    ReplyDelete
  4. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. web design agency lakeland

    ReplyDelete
  5. Evaluating the crypto landscape in the UNITED STATE, Dan thinks that Square is its greatest competitor. Unlike Square's Money App which offers Bitcoin (BTC) just, Revolut has four other major cryptocurrencies on the menu. Bitcoin bot

    ReplyDelete
  6. Bruc Bond endeavor to lead the financial sector with sustainability, customizable product offering, and open communication. At Bruc Bond we aim to make 21st century banking straightforward, simple, and transparent.

    ReplyDelete
  7. Bruc Bond endeavor to lead the financial sector with sustainability, customizable product offering, and open communication. At Bruc Bond we aim to make 21st century banking straightforward, simple, and transparent.

    ReplyDelete
  8. Supply and demand is a major determinant of the value of anything of value, including cryptocurrencies. This is because if more people are Top Bitcoin Gaming website willing to buy a cryptocurrency, and others are willing to sell, the price of that particular cryptocurrency will increase, and vice versa.

    ReplyDelete