Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2009, 02:08 AM   PM User | #1
toddedw
New to the CF scene

 
Join Date: May 2009
Location: Raleigh, NC, USA
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
toddedw is an unknown quantity at this point
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..
toddedw is offline   Reply With Quote
Old 05-14-2009, 03:06 AM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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>
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 05-14-2009, 03:14 AM   PM User | #3
toddedw
New to the CF scene

 
Join Date: May 2009
Location: Raleigh, NC, USA
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
toddedw is an unknown quantity at this point
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
toddedw is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:22 AM.


Advertisement
Log in to turn off these ads.