Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coinables/ffa33d3a1983b12bfdb68fcdac71ca99 to your computer and use it in GitHub Desktop.
Save coinables/ffa33d3a1983b12bfdb68fcdac71ca99 to your computer and use it in GitHub Desktop.
index.ejs
<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