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

<html><head><!--LoadtheAJAXAPI--><scripttype="text/javascript"src="https://www.google... <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, 谢谢!
展开
 我来答
swx1995
2012-11-11 · TA获得超过2696个赞
知道大有可为答主
回答量:1477
采纳率:0%
帮助的人:2394万
展开全部
你可以写<script>var xxx=……</script>然后js里用xxx变量代替动态内容 更好的办法是使用js中的ajax技术来请求网页数据并解析处理
追问
问题是怎么把动态的内容传入 xxx 中 ?
追答
你是用什么语言?ASP?php?还是
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
周正星
2012-11-12
知道答主
回答量:38
采纳率:0%
帮助的人:18.4万
展开全部
比如一个触发事件
html onclick="demo(3,1,1,1,2)"
js function demo(obj1,obj2,obj3,obj4,obj5){alert obj1};
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
何仁伟何仁伟
2012-11-11 · TA获得超过150个赞
知道小有建树答主
回答量:239
采纳率:100%
帮助的人:117万
展开全部
传入数组首地址 都一样滴
追问
问题是怎么在HTML里面定义个数组,然后怎么调用js里面的function ?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式