GHengeveld |
|
---|---|
Don't use body onload, its very dirty. Also you normally shouldn't put javascript in the header, but in the footer (just before </body>). If you use html parsing in pages you can just as well put it directly in the page body, right where you want the map to be displayed. It's not the best solution, but OK if it's just one page using it. Otherwise put it in page.tpl and try this:
<!-- IF {PAGE_ID} == xx --> JS code <!-- ENDIF --> Replace xx with the ID of the page you want the map to display on. You can also try pieters suggestion but that requires the page to have an alias. His code will work in footer.tpl as well (probably an even better solution). Try this: <script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(53.381883, -1.477755);
var myOptions = {
zoom: 15,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Sir Robert Hadfield Building"
});
}
jQuery(document).ready(function(){ initialize(); });
</script> Don't forget to remove the onload="initialize()" |