Skip to content

Instantly share code, notes, and snippets.

@dpc dpc/prices.html
Last active Dec 11, 2015

Embed
What would you like to do?
<html><head><title>Prices</title>
<script type="text/javascript" src="http://btcrate.com/convert.js?from=eur&to=btc"></script>
</head><body>
<table>
<tr>
<td>Beer 1</td><td><span id="eur0"></span></td><td><span id="btc0"></span></td>
</tr>
<tr>
<td>Beer 2</td><td><span id="eur1"></span></td><td><span id="btc1"></span></td>
</tr>
<tr>
<td>Beer 3</td><td><span id="eur2"></span></td><td><span id="btc2"></span></td>
</tr>
</table>
<script type="text/javascript">
window.onload = function() {
var prices = [1, 1.3, 2.1];
for (i = 0; i < prices.length; ++i) {
var val = prices[i];
document.getElementById("eur" + i.toString()).innerHTML="" + val.toFixed(2) + " EUR";
document.getElementById("btc" + i.toString()).innerHTML="" + (val * btcrate_com_rate).toFixed(3) + " BTC";
}
}
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.