39 lines
1.3 KiB
HTML
39 lines
1.3 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<script src="../lib/feed-tables.js"></script>
|
||
|
<title>Feed Tables Example</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<script>
|
||
|
var URL = "https://spreadsheets.google.com/feeds/list/0AoooUkEfVrhldEpRekRVakVYWmJ2U2Z4SFBVZ0M1Nnc/od6/public/basic?alt=json&callback=dataReady";
|
||
|
|
||
|
function loadData() {
|
||
|
var scp = document.createElement('script');
|
||
|
scp.setAttribute("type","text/javascript");
|
||
|
scp.setAttribute("src", URL);
|
||
|
document.getElementsByTagName("head")[0].appendChild(scp);
|
||
|
}
|
||
|
|
||
|
function dataReady(data) {
|
||
|
var table = new ListFeed(data, ["name", "street", "city"]);
|
||
|
|
||
|
var div = document.getElementById("table"), s = "";
|
||
|
|
||
|
for (var r = 0; r < table.length; r++) {
|
||
|
var row = table.getRow(r);
|
||
|
s += "<p>" + row.name + ", " + row.street + ", " + row.city + "</p>";
|
||
|
}
|
||
|
div.innerHTML = s;
|
||
|
}
|
||
|
|
||
|
window.onload = function() { loadData(); };
|
||
|
</script>
|
||
|
|
||
|
<h1>Data from the spreadsheet</h1>
|
||
|
<div id="table"></div>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|