我有一个菜单,点击页面应该打开的任何地方都有不同的地方,其中包含与页面相关的详细信息以及在地图上显示该地点的谷歌地图。 但是我创建了一个页面,该页面根据其id
显示不同地方的不同数据。 所以任何人都可以帮助我弄清楚如何使用该id
来显示不同的谷歌地图不同的地方。
把它放在你的标题中...
<script>
$(document).ready(function(){
$("AddressView").each(function(){
var embed ="<iframe style='margin-left:10px' width='215' height='215' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='https://maps.google.com/maps?&q="+ encodeURIComponent( $(this).text() ) +"&output=embed&iwloc'></iframe>";
$(this).html(embed);
});
});
</script>
并把它放在你想显示地图的地方......
<AddressView>
<?php echo (preg_replace('/'s+/', '', $POSTCODEVAR)); ?>
</AddressView>
根据需要更改样式。