简体   繁体   English

JavaScript验证中的W3C HTML

[英]W3C HTML in JavaScript validation

I have JavaScript in my template file, because of the smarty can't include the file and I have W3C problem validation: 我的模板文件中有JavaScript,因为聪明的人无法包含该文件,并且我有W3C问题验证:

addMarker({$item->lat}, {$item->lng}, '<div style="height: 280px;">dfdsfsd</div>');

Error element not allowed. 不允许错误元素。

Is there a way to escape it somehow? 有办法逃脱吗?

Split the start-tag and end-tag open delimiters: 分割开始标签和结束标签的打开定界符:

addMarker({$item->lat}, {$item->lng}, '<'+'div style="height: 280px;">dfdsfsd<'+'/div>');

Or replace them by escape sequences: 或将它们替换为转义序列:

addMarker({$item->lat}, {$item->lng}, '\x3Cdiv style="height: 280px;">dfdsfsd\x3C/div>');

最好将其拆分为'<d'+'iv和结束标记,否则将出现“没有开始标记的结束标记”错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM