-1

我想在 cfwindow 中显示谷歌地图。我创建了一个 cfwindow 并将源设置为包含我的谷歌地图的 url。我的地图下方的 html 表单显示,但实际地图不显示。为什么会发生这种情况,我能做些什么来纠正它?

见代码:

<!DOCTYPE html> 
 <html> 
 <head> 
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 

<script type="text/javascript"   
 src="http://maps.google.com/maps/api/js?sensor=false"> 

</head>
<body>
   <cfwindow name="w1" title="Location" initShow=true x=10 y=10 width="700" height="450" source="url to map">
    </cfwindow>
</body>

4

1 回答 1

0

In order for the google map to render, it needs to fire off some javascript. When opening content in a cfwindow, embedded javascript won't always run.

Verify that your initialization javascript is running on the URL to the map, and if not, use AjaxOnLoad (CF8+) to ensure the initialization script runs. You also need to make sure that any script assets are included from the parent page.

This is absolutely possible (click Directions on this example).

于 2011-08-04T19:11:39.660 回答