有人可以建议一种将参数(数据)从超链接(id =“inline”)传递到以下谷歌图表的方法。现在我在函数中有硬编码数据。另外我还想在aj 查询 fancybox(已经完成)..拜托!!寻找一些建议
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.js"></script>
<link rel="stylesheet" href="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript">
google.load('visualization', '1', {packages: ['columnchart']});
</script>
<script>
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
]);
var options = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById('data')).draw(data, options);
}
$(document).ready(function() {
$("a#inline").fancybox({
'hideOnContentClick': true,
onComplete: drawVisualization
});
});
</script>
</head>
<body>
<a id="inline" href="#data">Show Chart</a>
<div style="display:none"><div style='height:400px;width:600px' id="data"></div></div>
</body>
</html>