来自json的未定义对象与javascript(Undefined objects from json with javascript)

编程入门 行业动态 更新时间:2024-10-17 17:24:58
来自json的未定义对象与javascript(Undefined objects from json with javascript)

这里我有一个用于创建带有链接的地图和sibar的代码,但是在infowindow中一切都没问题,在侧边栏中我只得到未定义的文本:

http://jsbin.com/EVEWOta/23 (只需点击提交)

那究竟是什么问题呢?

码:

var side_bar_html = "<a href='javascript:google.maps.event.trigger(gmarkers["+parseInt(gmarkers.length-1)+"],\"mouseover\");'>"+place.name+"</a><br>"; document.getElementById('side_bar').innerHTML += side_bar_html; }

Here I have a code for creating map and sibar with links, but in infowindow all is ok, and in sidebar I only get undefined text:

http://jsbin.com/EVEWOta/23 (just click submit)

So what is exactly the problem?

CODE:

var side_bar_html = "<a href='javascript:google.maps.event.trigger(gmarkers["+parseInt(gmarkers.length-1)+"],\"mouseover\");'>"+place.name+"</a><br>"; document.getElementById('side_bar').innerHTML += side_bar_html; }

最满意答案

您正在使用RadarSearch 。

从文档:

由radarSearch()返回的PlaceResult对象仅包含geometry.location和reference属性。

没有.name属性

You are using RadarSearch.

From the documentation:

PlaceResult objects returned by radarSearch() will only include the geometry.location and reference properties.

There is no .name property

更多推荐

side_bar_html,sibar,infowindow,问题,电脑培训,计算机培训,IT培训"/> <meta name=&

本文发布于:2023-08-07 12:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464504.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   未定义   json   objects   Undefined

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!