Rifts Posted November 30, 2010 Share Posted November 30, 2010 Hey everyone, trying to get my site to validate as XHTML 1.0 Transitional. Getting this problem have no idea how I can fix it. document type does not allow element "b" here <script type="text/javascript"> var test=new Array(); test[0]='<b><u><?= $title2;?></u></b><br>'; Thanks Quote Link to comment https://forums.phpfreaks.com/topic/220262-problem-with-validating-htmlphp-inside-javascript/ Share on other sites More sharing options...
BlueSkyIS Posted November 30, 2010 Share Posted November 30, 2010 maybe try converting special html chars to their html equivalents, for example change < to < Quote Link to comment https://forums.phpfreaks.com/topic/220262-problem-with-validating-htmlphp-inside-javascript/#findComment-1141454 Share on other sites More sharing options...
Rifts Posted November 30, 2010 Author Share Posted November 30, 2010 didnt help Quote Link to comment https://forums.phpfreaks.com/topic/220262-problem-with-validating-htmlphp-inside-javascript/#findComment-1141458 Share on other sites More sharing options...
Adam Posted December 1, 2010 Share Posted December 1, 2010 Add HTML comments around your JavaScript: <script type="text/javascript"> <!-- // ... --> </script> That will cause the validator to ignore any mark-up it finds. Quote Link to comment https://forums.phpfreaks.com/topic/220262-problem-with-validating-htmlphp-inside-javascript/#findComment-1141580 Share on other sites More sharing options...
Rifts Posted December 1, 2010 Author Share Posted December 1, 2010 I love you! that worked perfectly Quote Link to comment https://forums.phpfreaks.com/topic/220262-problem-with-validating-htmlphp-inside-javascript/#findComment-1141907 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.