请问HTML中怎么向javascript中传递数组参数

<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, 谢谢!

第1个回答  2012-11-11
你可以写<script>var xxx=……</script>然后js里用xxx变量代替动态内容 更好的办法是使用js中的ajax技术来请求网页数据并解析处理追问

问题是怎么把动态的内容传入 xxx 中 ?

追答

你是用什么语言?ASP?php?还是

本回答被网友采纳
第2个回答  2012-11-12
比如一个触发事件
html onclick="demo(3,1,1,1,2)"
js function demo(obj1,obj2,obj3,obj4,obj5){alert obj1};本回答被提问者采纳
第3个回答  2012-11-11
传入数组首地址 都一样滴追问

问题是怎么在HTML里面定义个数组,然后怎么调用js里面的function ?