Chrome 上的 JavaScript 控制台说即使 my的 id 和在匹配中指定的 id也没有定义容器。有人知道为什么吗?div
getElementById
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
var data = [['Year', 'Disney', 'SeaWorld', 'Universal'], ['2013', 95, 100, 102]];
var options =
{
title:"Theme Park Prices",
width:600,
height:400,
hAxis: {title: "Year"},
};
var chart = new google.visualization.ColumnChart(document.getElementById('priceChart'));
function drawChart()
{
chart.draw(data, options);
}
drawChart();
</script>
<!-- End of chart code -->
</head>
<body>
<div id="priceChart" style="width: 600px; height: 400px;margin: 0 auto;"></div>
</body>
</html>