开发者

XHTML validation Error <script>

In WordPress I am using this code in my functions echo "<script type=\"text/javascript\"> which causes this XHTML validator error: "an attribute value must be a literal unless it contains only name characters"

I need this to be in my functions in WordPress开发者_运维问答, but also to be XHTML valid. I don't know much about any kind of coding, I'm a CSS and HTML junkie. Any help/

EDIT: REST OF THIS SECTION OF CODE:

if ($toggle == "no"){
echo '<link rel="stylesheet" href="'.get_template_directory_uri().'/tagmap.css" type="text/css" media="screen" />';
echo "\n\n";
echo "<script type=\"text/javascript\">
jQuery(document).ready(function() { 
  jQuery('ul.links li.hideli').hide();
  jQuery('ul.links li.morelink').show();
  jQuery('a.more').click(function() {
    jQuery(this).parent().siblings('li.hideli').slideToggle('fast');
     jQuery(this).parent('li.morelink').remove();
  });
});
</script>\n\n";


You are trying to validate <script type=\"text/javascript\">, which is invalid... the validation service highlights the slash character for you at column 14. You cannot have a slash character before the open quote starts in type=.

Update

Check the HTML source of your page which is what the validator is actually checking... line 21 Column 14 is where your Google Analytics code starts, not the jQuery code.

Line 20: <!-- Google Analytics -->
Line 21: <script type=\"text/javascript\">

You need to remove the slashes here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜