Hi Riaz, The clean approach is to put the JavaScript code in a JavaScriptExtension (see http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HMi... ) and leave only the HTML in the page content. Hope this helps, Marius On Mon, Nov 14, 2011 at 1:30 PM, Riaz Shafi <[email protected]> wrote:
Hi,
I'm struggling with adding a google map to an xwiki page using javascript. Below is the code I'm using which does not work. It's not easy to see where the problem is.
{{html clean="false" wiki="false"}}
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" id="script"> var tableid = 297050; var map;
function initialize() { map = new google.maps.Map(document.getElementById('map_canvas'), { center: new google.maps.LatLng(37.4, -122.1), zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP });
var layer = new google.maps.FusionTablesLayer({ query: { select: 'Address', from: tableid }, map: map }); } </script> <script> window.onload=initialize();
</script>
HELLO <table><tr><td width="400" height="400"> <div id="map_canvas" style="width:100%; height:100%"></div> </td></tr></table>
{{/html}}
The page can be viewed Today (14/11/2011) on http://playground.xwiki.org/xwiki/bin/view/Test/MapJavaScript Username: guest password guest123
The html page I am trying to display is shown here: http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/fusiontableslayer _example.html
Any help is much appreciated.
Thanks
Riaz
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs