0
我有一個可以正常工作的高圖,當JS內部有script
標籤時,但如果我移動到外部JavaScript,它會停止加載。 I gather我需要一個onLoad處理程序,但我對它的屬性感到困惑。示例onLoad處理程序?
這是我的HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript' src="//code.highcharts.com/highcharts.js"></script>
<script type='text/javascript' src="//code.highcharts.com/modules/drilldown.js"></script>
<script type='text/javascript' src="allspending.js"></script>
</head>
<body>
<div id="allspending" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>
這是(一個嚴重簡單化的版本) 「allspending.js」:
var allspending = [
[2002, 591856],
[2003, 839446],
[2004, 848463]
];
$(function() {
$('#allspendng').highcharts({
chart: {
type: 'column',
renderTo: 'allspending'
},
series: [{
data: allspending,
}]
});
});