PDA

View Full Version : Multiple lines of text in TextNode?



KE5EHI
08-30-2005, 02:24 AM
I'm playing around with integrating Google Maps on a site and putting an info window on it, but I want to add the name of a business with the address and phone number, but I don't know how to add multiple lines of text to it. The code for the window is

document.createTextNode("test"))

How do I add multiple lines to it?

The site I'm working on:http://www.jenksfitness.com/googlemap.htm
Add Google Maps to your site: http://www.google.com/apis/maps/

Twey
08-30-2005, 11:30 AM
Try seperating the lines with \n.

mwinter
08-30-2005, 05:10 PM
document.createTextNode("test"))

How do I add multiple lines to it?If you want to see multiple lines when viewing normally in the browser (rather than in the source), then you need to add HTML elements into the document as well. For instance, add the text to paragraph (p) elements when adding paragraphs of text, or append line break (br) elements after each relevant text node.

Mike

KE5EHI
08-30-2005, 06:10 PM
I couldn't get those to work. HTML tags don't seem to work in the textnode area. If I try to add, say bold text "(b)", it won't display anything at all on the page. If I put it in the quotes, it displays the code itself as text along with the text. I think Google is using a DOMIT! XML Parser, but I don't know how to code the text as HTML.

KE5EHI
08-30-2005, 06:31 PM
Right on, I just checked out Google's example.

var WINDOW_HTML = 'html text';

function loadMap() {
if (GBrowserIsCompatible()) {
var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(-95.97687, 36.022055), 4);
var marker = new GMarker(new GPoint(-95.97687, 36.022055));
map.addOverlay(marker);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(WINDOW_HTML);
});
marker.openInfoWindowHtml(WINDOW_HTML);
}
}
loadMap();
//]]>

Got-r-don