Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    could someone please help me understand how to do line breaks w/ the following code



    Code:
     function load() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.setCenter(new GLatLng(30.412175, -91.099187), 13);
            map.openInfoWindow(map.getCenter(),
                               document.createTextNode("Fenet Law Firm\n
                                                           8641 United Plaza\n
                                                            line break needed here,
                                                             and HERE!));
          }
        }

  2.  

  3. #2
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    the line breaks are needed around the address area

  4. #3
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Code:
     function load() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.setCenter(new GLatLng(30.412175, -91.099187), 13);
            map.openInfoWindow(map.getCenter(),
                               document.createTextNode("<pre>Fenet Law Firm\n
                                                           8641 United Plaza\n
                                                            line break needed here,
                                                             and HERE!</pre>"));
          }
        }
    Try that, also after the text HERE! you did not have a closing ".

  5. #4
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    whenever i insert the <pre> it complete makes the map dissappear.. im trying to insert the google api w/ an infobox w/ address


    Code:
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA_mnsBToJl019Y0GFhyYJIRQ_yn5R6lt9-4uDqpgdyizHSXVSpxQ-a08T_EJr1GY244fTETxtPQG2pg"
          type="text/javascript"></script>
        <script type="text/javascript">
    
        //<![CDATA[
    
        function load() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.setCenter(new GLatLng(30.412175, -91.099187), 14);
            map.enableGoogleBar();
            map.addControl(new GSmallMapControl());
            map.openInfoWindow(map.getCenter(),
                       document.createTextNode("<pre>adress
                                                      88888 street
                                                      city,state</pre>"));
        
          }
        }
        
    
        //]]>
        </script>
    
    <body onload="load()" onunload="GUnload()">

  6. #5
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    If I'm not mistaken, line breaks are allowed in string literals, but only in this form:
    Code:
    var str = 'lalalaa\
       lalala\
    lalala';
    It is important to note that line breaks will not be included in the string, but whitespaces will be. So what you will have is equivalent to...

    Code:
    var str = 'lalalaa   lalalalalala';
    Hope that helps.
    Hyperair

  7. #6
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    so do i put "\" after each line i want a line break?

  8. #7
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    im refering to a line break as a "carriage"

  9. #8
    Senior Member kade119's Avatar
    Join Date
    Feb 2007
    Location
    USA
    Posts
    532
    Member #
    14888
    Liked
    1 times
    more help... holla holla... como estas amigos


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:47 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com