本文介绍了Chatango嵌入式代码的W3C验证程序错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此我在我的网站上嵌入了一个chatango选项卡,但是在针对HTML进行验证时出现此错误。



元素脚本的文本内容不正确格式为:预期的空格,制表符,换行符或斜杠,但找到了{代替。



对此有任何解决方法?谢谢!

 < script id = cid0020000101807397328 data-cfasync = false async src = // st。 chatango.com/js/gz/emb.js style = width:603px; height:471px;> 
{ handle: ********, arch: js, styles:{ a: 000000, b:100, c : a0a0a0, d: FFFFFF, e: 202020, g: bbbbbb, h: 202020, j: c0c0c0, k: 0084ef, l: 606060, m: 0084ef, n: FFFFFF, p: 10, q: 000000, r:100, pos: br, cv:1, cvfntsz: 14px, cvbg: 3366ff, cvw:600, cvh:30, surl:0, allowpm :0, cnrs: 0.35, ticker:1, fwtickm:1}}}< / script>


解决方案

如Ben所述-您不能在标记内使用代码

但这是一些有效且可行的解决方案:

  <!DOCTYPE html> 
< html lang = ru>
< head>
< meta charset = utf-8>
<元http-equiv = X-UA-Compatible content = IE = edge>

< title> chatango< / title>

< / head>
< body>
< script type = text / javascript>
var chatango = document.createElement(’script’);
chatango.setAttribute('type','text / javascript');
chatango.setAttribute('id','cid0020000101807397328');
chatango.setAttribute('data-cfasync','false');
chatango.setAttribute(’async’,true);
chatango.setAttribute(’src’,’// st.chatango.com/js/gz/emb.js’);
chatango.setAttribute(’style’,’width:603px; height:471px;’);
chatango.innerHTML ='{ handle: 1shotgg, arch: js, styles:{ a: 000000, b:100, c: a0a0a0, d: FFFFFF, e: 202020, g: bbbbbb, h: 202020, j: c0c0c0, k: 0084ef , l: 606060, m: 0084ef, n: FFFFFF, p: 10, q: 000000, r:100, pos : br, cv:1, cvfntsz: 14px, cvbg: 3366ff, cvw:600, cvh:30, surl:0, allowpm:0 , cnrs: 0.35, ticker:1, fwtickm:1}}';;
document.body.appendChild(chatango);
< / script>
< / body>
< / html>


So I embedded a chatango tab on my website, but I get this error when validating it for HTML.

The text content of element script was not in the required format: Expected space, tab, newline, or slash but found { instead.

Any workarounds for this? Thank you!

<script id="cid0020000101807397328" data-cfasync="false" async src="//st.chatango.com/js/gz/emb.js" style="width: 603px;height: 471px;">
{"handle":"********","arch":"js","styles":{"a":"000000","b":100,"c":"a0a0a0","d":"FFFFFF","e":"202020","g":"bbbbbb","h":"202020","j":"c0c0c0","k":"0084ef","l":"606060","m":"0084ef","n":"FFFFFF","p":"10","q":"000000","r":100,"pos":"br","cv":1,"cvfntsz":"14px","cvbg":"3366ff","cvw":600,"cvh":30,"surl":0,"allowpm":0,"cnrs":"0.35","ticker":1,"fwtickm":1}}</script>
解决方案

As Ben said - you cannot use code inside tag with src.

But here is some valid and working solution:

<!DOCTYPE html>
<html lang="ru">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>chatango</title>

  </head>
  <body>
    <script type="text/javascript">
        var chatango = document.createElement('script');
        chatango.setAttribute('type','text/javascript');
        chatango.setAttribute('id','cid0020000101807397328');
        chatango.setAttribute('data-cfasync','false');
        chatango.setAttribute('async',true);
        chatango.setAttribute('src','//st.chatango.com/js/gz/emb.js');
        chatango.setAttribute('style','width: 603px;height: 471px;');
        chatango.innerHTML = '{"handle":"1shotgg","arch":"js","styles":{"a":"000000","b":100,"c":"a0a0a0","d":"FFFFFF","e":"202020","g":"bbbbbb","h":"202020","j":"c0c0c0","k":"0084ef","l":"606060","m":"0084ef","n":"FFFFFF","p":"10","q":"000000","r":100,"pos":"br","cv":1,"cvfntsz":"14px","cvbg":"3366ff","cvw":600,"cvh":30,"surl":0,"allowpm":0,"cnrs":"0.35","ticker":1,"fwtickm":1}}';
        document.body.appendChild(chatango);
    </script>
  </body>
</html>

这篇关于Chatango嵌入式代码的W3C验证程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 13:33