php*_*der 10 javascript google-visualization
我已将Google Code示例复制到php脚本中但是我收到错误"undefined is not a function"
它发生在这条线上:
var table = new google.visualization.Table(document.getElementById('table_sort_div'));
它表明Table函数不存在???
我直接从谷歌代码示例中复制了代码,所以我无法理解我做错了什么......我倾向于相信这个例子有问题,但我会假设我犯了一个错误谷歌之前会吗?
代码直接从以下位置复制:http://code.google.com/apis/chart/interactive/docs/examples.html#interaction_example
Joe*_*Joe 10
您需要等待脚本加载.例如:
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['table']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
var table = new google.visualization.Table(document.getElementById('table_sort_div'));
}
Run Code Online (Sandbox Code Playgroud)
应该工作,因为脚本已加载.这里有更好的表格参考
| 归档时间: |
|
| 查看次数: |
16296 次 |
| 最近记录: |