Javascript window.onload出错了吗
我从别人的api中获得了信息,但我无法将其取出,所以我将其写入了一个输入Javascript window.onload出错了吗,javascript,php,Javascript,Php,我从别人的api中获得了信息,但我无法将其取出,所以我将其写入了一个输入 for(var x=0;x< loc.length;x++){ point[x]=new window.BMap.Point(loc[x].lat, loc[x].lng); getloc(point[x],x); } function getloc(pt,i){ gc.getLocation(pt, function(rs){
for(var x=0;x< loc.length;x++){
point[x]=new window.BMap.Point(loc[x].lat, loc[x].lng);
getloc(point[x],x);
}
function getloc(pt,i){
gc.getLocation(pt, function(rs){
var addComp = rs.addressComponents;
var dd= addComp.city + "" + addComp.district + "" + addComp.street;
var addname="address"+i;
var text="<input type='hidden' value="+dd+" name="+addname+" />";
$(".page-container").append(text);
});
}
for(变量x=0;x
然后问题发生了
这是我的窗户
window.onload=function(){
var container_1_set={
chart: {
type: 'column'
},
title: {
text: 'sudden turn'
},
xAxis: {
categories: []
},
yAxis: {
min: 0,
title: {
text: 'sudden turn times'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
enabled:false
},
tooltip: {
formatter: function() {
return '<b>'+ this.x +'</b><br>'+
this.series.name +': '+ this.y +'<br>'+
'count: '+ this.point.stackTotal;
}
},
plotOptions: {
column: {
cursor:'pointer',
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
},
point:{
events:{
click:function(){
location.href="road_list.php?road="+this.category;
}
}
}
}
},
series: [{
name: 'sudden turn',
data: [ <?php foreach ($result["data"] as $item) {?>
{
y:<?php echo $item["time"];?>,
color:"<?php echo $item["color"];?>",
},
<?php }
?>]
}]
};
var cat=[];
for(var i=0;i<10;i++){
var aa=$("input[name='address"+i+"']").val();
cat.push(aa);
}
console.log(cat);
container_1_set.xAxis.categories=cat;
$('#container_1').highcharts(container_1_set);
};
window.onload=function(){
变量容器1\u集={
图表:{
类型:“列”
},
标题:{
文字:“突然转向”
},
xAxis:{
类别:[]
},
亚克斯:{
分:0,,
标题:{
文字:“急转弯时间”
},
堆叠标签:{
启用:对,
风格:{
fontWeight:'粗体',
颜色:(Highcharts.theme&&Highcharts.theme.textColor)| |“灰色”
}
}
},
图例:{
已启用:false
},
工具提示:{
格式化程序:函数(){
返回''+this.x+'
'+
this.series.name+':'+this.y+'
'+
“计数:”+this.point.stackTotal;
}
},
打印选项:{
专栏:{
游标:'指针',
堆叠:“正常”,
数据标签:{
启用:对,
颜色:(Highcharts.theme&&Highcharts.theme.dataLabelsColor)| |“白色”
},
要点:{
活动:{
单击:函数(){
location.href=“road_list.php?road=“+this.category;
}
}
}
}
},
系列:[{
名称:“急转弯”,
数据:[
{
y:,,
颜色:“,
},
]
}]
};
var cat=[];
对于(var i=0;i窗口加载不是必需的。相反,您已经准备好了文档。无需同时使用这两种方法。您的意思是$(窗口)。加载
,没有(标准的)窗口。加载
。cat数组应该是数字而不是字符串吗?如果您已经使用,