Results 1 to 5 of 5

Thread: Multiple lines of text in TextNode?

  1. #1
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Multiple lines of text in TextNode?

    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/

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Try seperating the lines with \n.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by KE5EHI
    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

  4. #4
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  5. #5
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •