Google [站内搜索]

分类: 脚本语言预览模式: 普通 | 列表
先在页面引入Hanzi Writer脚本:

<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hanzi-writer@2.2/dist/hanzi-writer.min.js"></script>

1、静态输出汉字

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 157
使用Chrome控制台调试页面时,如果页面没有使用jQuery调试起来不方便,我们可以在控制台给页面动态引入jQuery方便调试:

var importJs=document.createElement('script');
importJs.setAttribute("type","text/javascript");
importJs.setAttribute("src", 'https://code.jquery.com/jquery-1.12.4.min.js');

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 91

[私密日志] 私密日志

该日志是私密日志,只有博主或发布者可以查看!
分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 69

Javascript严格模式(use strict)使用示例

在Javascript严格模式下,有的操作是不被允许的,例如使用未声明的变量、删除变量或对象、对只读属性赋值等等,这些规定使编程更加严谨。严格模式在 Javascript 1.8.5 (ECMAScript5) 中新增,使用起来非常简单,只需要在脚本或函数的开头加个use strict指令即可,脚本运行时解释器会严格检查程序是否规范。use strict不是一条语句,它只是一个字面量表达式,在 Javascript 旧版本中会被忽略。

支持严格模式的浏览器:Internet Explorer 10 +、 Firefox 4+ Chrome 13+、 Safari 5.1+、 Opera 12+。

Javascript严格模式使用示例

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 97

JS实现json对象数组按属性进行排序示例

我们先定义一个用于演示的json对象数组:

var result=[
  {id:1,name:'张三'},
  {id:3,name:'李四'},

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 84

Don’t Use jquery-latest.js[转]

Earlier this week the jQuery CDN had an issue that made the jquery-latest.js and jquery-latest.min.js files unavailable for a few hours in some geographical areas. (This wasn’t a problem with the CDN itself, but with the repository that provides files for the CDN.) While we always hope to have 100% uptime, this particular outage emphasized the number of production sites following the antipattern of using this file. So let’s be clear: Don’t use jquery-latest.js on a production site.

We know that jquery-latest.js is abused because of the CDN statistics showing it’s the most popular file. That wouldn’t be the case if it was only being used by developers to make a local copy. The jquery-latest.js and jquery-latest.min.js files were meant to provide a simple way to download the latest released version of jQuery core. Instead, some developers include this version directly in their production sites, exposing users to the risk of a broken site each time a new version of jQuery is released. The team tries to minimize those risks, of course, but the jQuery ecosystem is so large that we can’t possibly check it all before making a new release.

To mitigate the risk of “breaking the web”, the jQuery team decided back in 2013 that jquery-latest.js could not be upgraded to the 2.0 branch even though that is technically the latest version. There would just be too many sites that would mysteriously stop working with older versions of Internet Explorer, and many of those sites may not be maintained today.

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 277

jQuery自定义事件添加触发示例

我们可以用jQuery的on方法在任一对象上添加自定义事件,之后用trigger方法手工触发自定义事件,代码示例:

<!doctype html>
<html>
    <head>

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 289
HTML
<script src="jquery-3.4.1.min.js"></script>

jQuery Core - All 3.x Versions - 不兼容IE6/7/8,只支持最新的浏览器。

jQuery Core 3.4.1: http://code.jquery.com/jquery-3.4.1.min.js (更新日志)

查看更多...

分类:脚本语言 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 518