在屏幕截图中,我想在框中自动添加货币,我如何让它这样做。货币每天都在变化
html和javascript中的代码
<font color="red"><b><label for="usd">leave blank</label></b></font>
<font color="PURPLE"><b><label for="zar"></label></b></font>
<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">
下面第一行的结果是正确的
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>function reloadFnAj0a2vV(){ var sc = document.getElementById('scFnAj0a2vV');if (sc) sc.parentNode.removeChild(sc);sc = document.createElement('script');sc.type = 'text/javascript';sc.charset = 'UTF-8';sc.async = true;sc.id='scFnAj0a2vV';sc.src = 'https://freecurrencyrates.com/en/widget-horizontal?iso=USD-ZAR&df=1&p=FnAj0a2vV&v=fits&source=fcr&width=500&width_title=225&firstrowvalue=1&thm=8E846B,FEEEBD,494437,817865,FFFFFF,D19405,FECE2F,383838,000000&title=Currency%20Converter&tzo=-120';var div = document.getElementById('gcw_mainFnAj0a2vV');div.parentNode.insertBefore(sc, div);} reloadFnAj0a2vV(); </script>
暂无答案!
目前还没有任何答案,快来回答吧!