Skip to content

Instantly share code, notes, and snippets.

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

What would you like to do?
<script type="text/javascript" src=""></script>
<td>Beer 1</td><td><span id="eur0"></span></td><td><span id="btc0"></span></td>
<td>Beer 2</td><td><span id="eur1"></span></td><td><span id="btc1"></span></td>
<td>Beer 3</td><td><span id="eur2"></span></td><td><span id="btc2"></span></td>
<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";
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.