I have a webpage ,that gets and show currency in different currency info.
Then I have html code with a box that I manually type in the currency I want to use.
Then I have JavaScript to add two numbers together.
How can I use JavaScript or html to get the correct currency I want and add it to the the box by itself, and add it with other number.
[CODE lang="html" title="Html"] <label for="usd">leave blank</label>
<input readonly="readonly" type="usdzar" id="usd" name="usd">
<label for="zar"></label>
<input style="color: #17202A; font-family: Comic Sans MS; font-weight: bold; font-size: 12px; background-color: #AED6F1; type="usdzar" id="zar" name="zar">
<button type="button" onclick="multiply1()">Multiply</button>
<input style="color: #17202A; font-family: Comic Sans MS; font-weight: bold; font-size: 12px; background-color: #E8F8F5; type="text" id="result1" name="result1">
[/CODE]
Then I have html code with a box that I manually type in the currency I want to use.
Then I have JavaScript to add two numbers together.
How can I use JavaScript or html to get the correct currency I want and add it to the the box by itself, and add it with other number.
[CODE lang="html" title="Html"] <label for="usd">leave blank</label>
<input readonly="readonly" type="usdzar" id="usd" name="usd">
<label for="zar"></label>
<input style="color: #17202A; font-family: Comic Sans MS; font-weight: bold; font-size: 12px; background-color: #AED6F1; type="usdzar" id="zar" name="zar">
<button type="button" onclick="multiply1()">Multiply</button>
<input style="color: #17202A; font-family: Comic Sans MS; font-weight: bold; font-size: 12px; background-color: #E8F8F5; type="text" id="result1" name="result1">
[/CODE]
JavaScript:
<script>
function multiply1(){
var num3 = document.getElementById("result").value.replace(/,/g,''); //remove any commas
var num4 = document.getElementById("zar").value;
var result1 = num3 * num4;
document.getElementById("result1").value = result1.toLocaleString('en-US',{ maximumFractionDigits: 8 });
document.getElementById("result1").style.color = "red";
document.getElementById("result1").style.fontWeight = "900";
}
</script>