How to add using currency converter a new currency and show the price from the the BTC that is already showing in html
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
Good day.
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
var num5 = document.getElementById(“firstNum1”).value;
document.getElementById(“secondNum1”).value = 13630344.17961704;
var num6 = document.getElementById(“secondNum1”).value;
var result3 = num5 * num6;
document.getElementById(“result3”).value = result3.toLocaleString(‘en-US’, {
maximumFractionDigits: 8
});
document.getElementById(“result3”).style.color = “red”;
document.getElementById(“result3”).style.fontWeight = “900”;
}
function multiply4() {
var num7 = document.getElementById(“result3″).value.replace(/,/g, ”); //remove any commas
var num8 = document.getElementById(“gcw_valFnAj0a2vV1”).value;
var result4 = num7 * num8;
document.getElementById(“result4”).value = result4.toLocaleString(‘en-US’, {
maximumFractionDigits: 8
});
document.getElementById(“result4”).style.color = “red”;
document.getElementById(“result4”).style.fontWeight = “900”;
}
$(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);
});
});
<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>
I display, and the ZAR must then auto update to new price.
it must show like this in html
1 BTC = to $2200.97777
1 BTC = t0 (if ZARr is at that moment R15.00 to 1$) R308325.0
أضف إجابة