son Posted January 17, 2012 Share Posted January 17, 2012 I have some trouble validating code that I generated via PHP as: echo "document.write('<p id=\"slidesHint\">Info Text</p>')"; Where is the issue with this? Thanks,Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 17, 2012 Share Posted January 17, 2012 What does the validator say is the problem? Link to comment Share on other sites More sharing options...
son Posted January 18, 2012 Author Share Posted January 18, 2012 It complainsdocument type does not allow element "p" hereThe Javascript is embedded in between <div> and </div> Son Link to comment Share on other sites More sharing options...
Ingolme Posted January 18, 2012 Share Posted January 18, 2012 The validator thinks you have a <p> element inside the <script> element. Put your code between CDATA tags to see if it gets solved: <script type="text/javascript">//<![CDATA[<?php echo "document.write('<p id=\"slidesHint\">Info Text</p>')"; ?>//]]></script> Why are you using document.write if PHP can write the code directly for you? Link to comment Share on other sites More sharing options...
son Posted January 18, 2012 Author Share Posted January 18, 2012 I use Javascript as this p is directly under a javascript generated slideshow and I only want to show text if javascript is enabled... Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.