<html>
<head>
<!--Load the AJAX API-->
<scripttype="text/javascript"src="https://www.google.com/jsapi"></script>
<scripttype="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization','1.0',{'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart(){
// Create the data table.
var data =new google.visualization.DataTable();
data.addColumn('string','Topping');
data.addColumn('number','Slices');
data.addRows([
['Mushrooms',3],
['Onions',1],
['Olives',1],
['Zucchini',1],
['Pepperoni',2]
]);
// Set chart options
var options ={'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart =new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<divid="chart_div"style="width:400;height:300"></div>
</body>
</html>
以上是google chart 的样本程序.
请问下画图那些数据如 (3,1,1,1,2) 如果是想在HTML中用数组传入去, (实际应用上是用其它方式动态获得的.)
该怎么修改HTML, 谢谢!
问题是怎么把动态的内容传入 xxx 中 ?
追答你是用什么语言?ASP?php?还是
本回答被网友采纳html onclick="demo(3,1,1,1,2)"
js function demo(obj1,obj2,obj3,obj4,obj5){alert obj1};本回答被提问者采纳
问题是怎么在HTML里面定义个数组,然后怎么调用js里面的function ?