Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Location
    Raleigh, NC, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    xHTML Validation w/ Google Maps API

    Hello Ladies and Gentlemen,

    I hope some of you are familiar with the Google Maps API because I'm stumped. Here is my issue:

    Code:
    var point = new GLatLng(<?echo $dataArray[1].",".$dataArray[2]?>);
    var marker = createMarker(point,'<div><?echo date('m-d-Y H:i:s',"$dataArray[0]")."<br />".round((($dataArray[4] / 1609.344)*60)*60)."mph<br /><br />";?></div>')
    map.addOverlay(marker);
    I'm basically creating a bubble on the map when someone clicks one of my way points. I need to have line breaks inside the bubble and so far xHTML will not validate no matter what I do. I'm stumped. Any ideas would be greatly appreciated.

    Error:

    1. Error Line 160, Column 44: document type does not allow element "div" here

    …ar marker = createMarker(point,'<div>05-13-2009 21:07:27<br />0mph<br /><br /



    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).


    Thanks in advance!
    Last edited by toddedw; 05-14-2009 at 03:14 AM.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,624
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    Have you wrapped CDATA tags around your script (if inside HTML file)? In XHTML it should always look like this:

    Code:
    <script type="text/javascript">
    // <![CDATA[
    
    your script here
    
    // ]]>
    </script>

  • #3
    New to the CF scene
    Join Date
    May 2009
    Location
    Raleigh, NC, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Code:
    <script type="text/javascript">
    // <![CDATA[
    
    your script here
    
    // ]]>
    </script>
    Thank you very much. It has been a long time since I have tinkered with JavaScript and my OCD nature cannot allow me to have anything less than xHTML strict.

    Thanks again!
    Last edited by toddedw; 05-14-2009 at 03:16 AM. Reason: typo


  •  

    Posting Permissions

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