Good day.
Need help on the following.
1 BTC = to $2200.97777 1 BTC = t0 (if ZARr is at that moment R15.00 to 1$) R308325.0
Need help on the following.
- I am getting BTC price from binnance with a stream (this part is working.)
- I have my script on currency converter to ZAR (working)
- I can display the price of BTC in my html.
- No I need to know on how to show the price in html for ZAR, some of the code is working, if I click on multiplay is is working.
- How can I make it that it will auto multiply (if I have only 1 BTC it must multiply from currency to ZAR and show show in in html)
- How can I make it also if I have more BTC (I can add it in JavaScript to auto multiply and show in html.
- It must use the price that I display at the moment, and the ZAR must then auto update to ne price.
1 BTC = to $2200.97777 1 BTC = t0 (if ZARr is at that moment R15.00 to 1$) R308325.0
HTML:
<div class='col-2 p-5 me-5'>
<div class='uit d-flex justify-content-end mb-3'>BTC</div>
<div class='uit d-flex justify-content-end mb-3'>1 USD</div>
<div id='show_price_binance_btc'><span>...</span></div>
<div id="gcw_valFpWbgYyUL0">...</span></div>
</div>
<div class='col-2 p-5 me-5'>
<td><input type="number1" id="firstNum1" name="firstNum1"></td>
<td><label for="secondNum1">140,000.000111</label></b></td>
<input style="visibility:hidden" type="number1" id="secondNum1" name="secondNum1"></td>
<td><button type="button" onclick="multiply2()">Multiply</button></td>
<td><input type="text" id="result3" name="result3"/></td>
<input style="visibility:collapse" type="usdzar1" id="usd1" name="usd1">
<label for="zar1"></label>
<input style="visibility:collapse" type="usdzar1" id="gcw_valFnAj0a2vV1" name="zar1">
<td><button type="button" onclick="multiply4()">Multiply</button></td>
<td><input type="text" id="result4" name="result4"/></td>
</div>
JavaScript:
<script>
function multiply5(){
var num9 = document.getElementById("firstNum2").value;
document.getElementById("secondNum2").value = 0.00003390;
var num10 = document.getElementById("secondNum2").value;
var result5 = num9 * num10;
document.getElementById("result5").value = result5.toLocaleString('en-US',{ maximumFractionDigits: 8 });
document.getElementById("result5").style.color = "red";
document.getElementById("result5").style.fontWeight = "900";
}
</script>
<script>
function multiply6(){
var num11= document.getElementById("result5").value.replace(/,/g,''); //remove any commas
var num12 = document.getElementById("gcw_valFnAj0a2vV1").value;
var result6 = num11 * num12;
document.getElementById("result6").value = result6.toLocaleString('en-US',{ maximumFractionDigits: 8 });
document.getElementById("result6").style.color = "red";
document.getElementById("result6").style.fontWeight = "900";
}
</script>
JavaScript:
<script>
$(document).ready( function () {
$('#datatable').DataTable({
"paging": false,
"searching": false,
});
} );
$(document).ready(function() {
var baseUSD = '<?=$baseUSD?>';
var coin_rate_in_ZAR = '<?=$coin_rate_in_ZAR?>';
var coin_rate_in_USD = '<?=$coin_rate_in_USD?>';
$('#gcw_valFpWbgYyUL0').val(baseUSD);
$('#gcw_valFpWbgYyUL1').val(coin_rate_in_ZAR);
// When USD value changes
$('#gcw_valFpWbgYyUL0').on('keyup',function(){
var baseUSD = $('#gcw_valFpWbgYyUL0').val();
var valueInZar = baseUSD * coin_rate_in_ZAR;
// alert(valueInZar);
$('#gcw_valFpWbgYyUL1').val(valueInZar);
});
// When ZAR value changes
$('#gcw_valFpWbgYyUL1').on('keyup',function(){
var baseZAR = $('#gcw_valFpWbgYyUL1').val();
var valueInUSD = (baseZAR * coin_rate_in_USD).toFixed(4);
// alert(valueInUSD);
$('#gcw_valFpWbgYyUL0').val(valueInUSD);
});
});
</script>