Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add currency to as value

Status
Not open for further replies.

hendrikbez

Technical User
Nov 3, 2003
54
ZA
I need help with the following.
On MY JAVASCRIPT CODE I need num4 to use the currency automatically for ZAR using USD (1$=14.01 ZAR) using the CURRENCY SCRIPT, but not sure how to do it

MY HTML Code
HTML:
<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">

MY JAVASCRIPT CODE
Java:
<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>


Currency Script
Java:
<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 = '[URL unfurl="true"]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[/URL] div = document.getElementById('gcw_mainFnAj0a2vV');div.parentNode.insertBefore(sc, div);} reloadFnAj0a2vV(); </script>





How will you spend eternity - Smoking or Non Smoking?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top