如何在编辑器里添加CSS或JS代码
//编辑器里代码模式下的代码
<scripttype="text/javascript">
//my code....
</script>
//编辑器里可视化模式下的代码
<scripttype="text/javascript">
// <![CDATA[
//my code....
// ]]>
</script>
最近在使用Wordpress做一个网站项目,需要在后台编辑器里添加自定义的JS脚本和CSS
CDATA sections in XHTML documents are liable to be parsed differently by web browsers if they render the document as HTML, since HTML parsers do not recognise the CDATA start and end markers, nor do they recognise HTML entity references such as < within <script> tags. This can cause rendering problems in web browsers and can lead to cross-site scripting vulnerabilities if used to display data from untrusted sources, since the two kinds of parser will disagree on where the CDATA section ends.
Since it is useful to be able to use less-than signs (<) and ampersands (&) in web page scripts, and to a lesser extent styles, without having to remember to escape them, it is common to use CDATA markers around the text of inline <script> and <style> elements in XHTML documents. But so that the document can also be parsed by HTML parsers, which do not recognise the CDATA markers, the CDATA markers are usually commented-out, as in this JavaScript example:
//JavaScript example:
<script type="text/javascript">
//<![CDATA[
//mycode
document.write("<");
//]]>
</script> //CSS example:
<style type="text/css">
/*<![CDATA[*/
//my code
body { background-image: url("marble.png?width=300&height=300")}
/*]]>*/
</style>
如何在编辑器里添加CSS或JS代码的更多相关文章
- Asp.net 后台添加CSS、JS、Meta标签
Asp.net 后台添加CSS.JS.Meta标签的写法,我这里写成函数方便以后使用.如果函数放在页面类中, Page参数也可以不要. 首先导入命名空间 using System.Web.UI.Htm ...
- Atom编辑器折腾记_(13)JS代码智能提示补全(插件:atom-ternjs)
题外话 官方正式版尽管内置了.autocomplete-plus;最为明显的一个功能就是记忆你已经输入过的名称进行匹配; 可是针对于某些语言来说,还是有些不足的-.当中JS的补全上就明显不足了-所以须 ...
- 用python给html里的css及js文件链接自动添加版本号
传统的给文件链接添加版本号的方法是使用gulp-rev,这里提出的解决方案是使用python来替代gulp-rev. import os import re import uuid import sy ...
- require.js添加css文件实现代码:css.min.js
define( function () { if (typeof window == "undefined")return { load: function (n, r, load ...
- Atom编辑器折腾记_(15)JS代码片段补全(插件:javascript-snippets)
题外话 这款插件就比較重量级了-.用熟悉了写原生JS的效率要提升非常多--并且,不仅支持JS还包括了nodejs snippet javascript-snippets 插件作者: zenorocha ...
- 测试博文中添加可执行JS代码
昨天申请开通了博客园的JS权限,今天来看看效果. 测试执行JS 测试执行JS // 运行
- 图片的滑动缩放html、css、js代码
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- Django中简单添加HTML、css、js等文件(非正规添加,适合小白)
Django中简单添加HTML.css.js等文件 首先申明下自己的环境, python版本3.65(亲测3.7版本有毒,没解决掉!) Django版本1.11.15(版本比较成熟,也可以用最新的版本 ...
- 配置grunt进行css、js的检查、合并和压缩
现在会进行代码的合并和压缩已成为前端人员的必备知识,那么现在来介绍一个grunt的工具.grunt是个风靡世界的工具,它的首页是 http://www.gruntjs.net 这是个中文网站,有文档 ...
随机推荐
- 收集的一些MikroTik RouterOS 5.x破解版
链接:https://pan.baidu.com/s/1RyREMfrpLkpQ-AIcDQES_Q 密码:byhd
- x270
https://thinkpad.lenovo.com.cn/product/93964.html
- 记录Linux启动流程的工具bootchart
/********************************************************************* * Author : Samson * Date ...
- Revit API判断直线相交关系移动风管
start ) ); )) )) ); XYZ xyz12 = lCurve1.Curve.get_EndPoint(); XY ...
- 解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER
今天在用java与mysql数据库时发现Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COER ...
- Xamarin.Android,Xamarin.iOS, Linking
Xamarin.Android applications use a linker in order to reduce the size of the application. The linker ...
- 【mybatis】mybatis进行批量更新,报错:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right
使用mybatis进行批量更新操作: 报错如下: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an erro ...
- String转Date的类型转换器
import org.apache.commons.beanutils.Converter; import org.apache.commons.lang.StringUtils; /* * 定义转换 ...
- 数据访问:Implementing Efficient Transactions
An OLTP scenario is characterized by a large number of concurrent operations that create, update, an ...
- Python:Opening Python Classes
I won’t reply to that post much, because it’s mostly… well, not useful to respond to. But people oft ...