Page 1 of 1

Line Breaks Using Google Maps

Posted: Sun Feb 14, 2010 4:18 pm
by drumking88
I'm trying to have a line break in my google map code. I'm using V2 of the API. My code is as follows:

(p.s The PHP variables are showing up fine.)

Code: Select all

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=offline&sensor=false"
            type="text/javascript"></script>
    <script type="text/javascript">
    
    <?php
    echo "var oldNames = new Array('$Name' ,'$Street', '$City', '$Postcode');";
    ?>
    
 
 
  function initialize() {
  var map = new GMap2(document.getElementById("map_canvas"));
  //set center of map. Database driven
  map.setCenter(new GLatLng(<?php echo $pos ; ?>), 16);
  //style of map.
  map.setMapType(G_NORMAL_MAP);
  //Add Informational Window in HTML. (Output
  //to be database driven!
  map.openInfoWindow(map.getCenter(),
                     document.createTextNode("This is the Headquaters of  <?php echo $name ?>! <br> New line text here!"));
    var map_point = new GLatLng(<?php echo $pos; ?>);
    map.addOverlay(new GMarker(map_point));
  
  }
 
    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 500px; height: 300px"></div>
  </body>
</html>