Created
May 7, 2018 02:15
-
-
Save coinables/ffa33d3a1983b12bfdb68fcdac71ca99 to your computer and use it in GitHub Desktop.
index.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
Create Brain Wallet | |
<h1>BTC USD Converter</h1> | |
<input type="text" id="btc" value="1" onkeyup="return btcusd();" onchange="return btcusd();"> = | |
<input type="text" id="usd" value="<%= lastPrice %>" onkeyup="return usdbtc();" onchange="return usdbtc();"> | |
<script> | |
function btcusd(){ | |
let market_price = <%= lastPrice %>; | |
let btc_value = document.getElementById("btc").value; | |
let calc = btc_value * market_price; | |
document.getElementById("usd").value = calc.toFixed(2); | |
}; | |
function usdbtc(){ | |
let market_price = <%= lastPrice %>; | |
let btc_value = document.getElementById("usd").value; | |
let calc = usd_value / market_price; | |
document.getElementById("btc").value = calc.toFixed(8); | |
}; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment