问题描述
我目前正在使用Tabletop使电子表格的行为类似于我的Blogspot的数据库
<html>
<body>
<p id="demo"></p>
<script src='https://cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.5.1/tabletop.min.js'></script>
<script type='text/javascript'>
var publicSpreadsheetUrl = '1ZXZVfon9ywNelbVEchOu9HQbSLZJRE-x6G2xOFPA-lA';
function init() {
Tabletop.init( { key: publicSpreadsheetUrl,callback: showInfo,simpleSheet: true } )
}
function showInfo(data,tabletop) {
alert('Successfully processed!' + data.length + 'rows!')
// console.log(data);
var str = JSON.stringify(data);
document.getElementById("demo").innerHTML = str;
}
document.write("Document <a target='_new' href='" + publicSpreadsheetUrl + "'>Here</a>");
window.addEventListener('DOMContentLoaded',init)
</script>
</body>
</html>
[enter image description here][1]
如何使用局部变量,以便我可以在函数外部打印,像这样
function showInfo(data,tabletop) {
alert('Successfully processed!' + data.length + 'rows!')
// console.log(data);
var str = JSON.stringify(data);
}
document.getElementById("demo").innerHTML = str;
document.write("Document <a target='_new' href='" + publicSpreadsheetUrl + "'>Here</a>");
window.addEventListener('DOMContentLoaded',init)
</script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)