<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Program/Javascript | Hessian's Blog</title><link>https://hessian.cn/cat/program/javascript</link><description>Hessian 的技术笔记：Linux、C++、网络与嵌入式</description><language>zh-CN</language><atom:link href="https://hessian.cn/cat/program/javascript/index.xml" rel="self" type="application/rss+xml"/><item><title>Nuxt不停机部署指南</title><link>https://hessian.cn/p/1643.html</link><pubDate>Fri, 22 Oct 2021 18:49:53 +0800</pubDate><guid>https://hessian.cn/p/1643.html</guid><description>在我们的服务器环境中有不少Nuxt应用，但是项目的配置都有问题，会导致项目部署重启的时候会不可用，提示 502 Bad Gateway。而且启动服务的时候总会有奇怪的错误信息，而真正的错误日志又看不到。&#10;</description></item><item><title>让KindEditor支持MP4视频（使用ckplayer播放器）</title><link>https://hessian.cn/p/1544.html</link><pubDate>Tue, 29 Jan 2019 01:57:38 +0800</pubDate><guid>https://hessian.cn/p/1544.html</guid><description>参考文章：https://blog.csdn.net/zhjx922/article/details/7601660&#10;KindEditor本身支持音视频文件的上传，但是对于这些文件的支持是依赖于浏览器控件的，兼容性很差，而且现在比较常见的视频文件MP4也不支持，因此本文提供了对KindEditor进行修改的办法，使其在添加视频后可直接使用CKplayer进行播放。&#10;</description></item><item><title>Vue.js 学习资料</title><link>https://hessian.cn/p/1538.html</link><pubDate>Sat, 26 Jan 2019 11:51:41 +0800</pubDate><guid>https://hessian.cn/p/1538.html</guid><description>awesome-vue （项目大集合） https://github.com/vuejs/awesome-vue&#10;前端开发之走进Vue.js http://www.jianshu.com/p/78c9e5342990&#10;ECMAScript 6入门 http://es6.ruanyifeng.com/&#10;Vue.js 指南 https://cn.vuejs.org/v2/guide/&#10;Vue.js API&#10;https://cn.vuejs.org/api&#10;vue-router https://github.com/vuejs/vue-routerhttp://router.vuejs.org/zh-cn/advanced/meta.html&#10;vue-resource&#10;https://github.com/pagekit/vue-resource&#10;vue-cli&#10;官方指南：https://cli.vuejs.org/zh/guide/ https://github.com/vuejs/vue-cli&#10;https://github.com/vuejs-templates/webpack&#10;http://vuejs-templates.github.io/webpack/&#10;https://github.com/vuejs/vue-cli&#10;https://github.com/vuejs-templates/webpack&#10;http://vuejs-templates.github.io/webpack/&#10;vuex 中文文档&#10;https://vuefe.cn/vuex/actions.html&#10;官方实例 https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart&#10;vuex入门实例(中文，非官方) https://segmentfault.com/a/1190000005018970#articleHeader11&#10;</description></item><item><title>SimpleScriptLoader for Firefox 一个简单的脚本加载工具</title><link>https://hessian.cn/p/1333.html</link><pubDate>Fri, 16 Aug 2013 01:49:39 +0800</pubDate><guid>https://hessian.cn/p/1333.html</guid><description>最近在做的一个项目需要调用JS文件对网页内容进行修改，老是用Firefox复制粘贴特别麻烦，于是乎就顺手写了个小扩展SimpleScriptLoader。这个小东西可以手动或者自动的加载指定的JS文件，非常简单易用。&#10;</description></item><item><title>一些网站开发中常用到的Javascript项目</title><link>https://hessian.cn/p/1083.html</link><pubDate>Thu, 18 Apr 2013 12:54:51 +0800</pubDate><guid>https://hessian.cn/p/1083.html</guid><description>图片轮播 SlideJS SlidesJS is a responsive slideshow plug-in for jQuery (1.7.1+) with features like touch and CSS3 transitions. Give it a try above and check out the examples to help you get started adding SlidesJS to your project.&#10;官方地址： http://www.slidesjs.com/&#10; &#10;图片滚动（Marquee） jCarousel jCarousel是一款 jQuery 插件， 用来控制水平或垂直排列的列表项. 这些项目（可以是静态HTML内容或是Ajax加载内容）内容是可以来回滚动的（可以有动画效果）。&#10;</description></item><item><title>[转]如何修复 “Internet Explorer 无法打开 Internet 站点….”</title><link>https://hessian.cn/p/556.html</link><pubDate>Wed, 09 Apr 2008 14:56:00 +0800</pubDate><guid>https://hessian.cn/p/556.html</guid><description>src:http://www.nirmaltv.com/2007/08/08/how-to-fix-internet-explorer-cannot-open-the-internet-site-operation-aborted-error/&#10;How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error&#10;Of late few of my blog readers using Internet explorer pointed out to me that there was some error happening while loading my blog in IE. Around 25% of my readers use Internet Explorer to read my blog. I check my blog frequently in IE and many times I too encountered this error, but initially I thought it was some error in my browser. The error is really frustrating as it shows only in IE and not in Firefox or Opera or any other browser for that matter.&#10;</description></item><item><title>[转]JavaScript类的继承</title><link>https://hessian.cn/p/479.html</link><pubDate>Mon, 07 Jan 2008 15:11:00 +0800</pubDate><guid>https://hessian.cn/p/479.html</guid><description>利用共享prototype实现继承&#10;继承是面向对象开发的又一个重要概念，它可以将现实生活的概念对应到程序逻辑中。例如水果是一个类，具有一些公共的性质；而苹果也是一类，但它们属于水果，所以苹果应该继承于水果。&#10;在JavaScript中没有专门的机制来实现类的继承，但可以通过拷贝一个类的prototype到另外一个类来实现继承。一种简单的实现如下：&#10;fucntion class1(){&#10;      //构造函数&#10;}&#10;</description></item><item><title>INTRODUCTION TO JavaScript Functions</title><link>https://hessian.cn/p/617.html</link><pubDate>Mon, 09 Jul 2007 01:04:00 +0800</pubDate><guid>https://hessian.cn/p/617.html</guid><description>作者：F. Permadi&#10;译者：Sheneyan(子乌)&#10;英文原文： INTRODUCTION TO JavaScript Functions&#10;中文译文(包括示例)：javascript的函数&#10;子乌注：一篇相当不错的function入门文章，个人感觉相当经典。&#10;</description></item><item><title>自动创建selectbox的多级联动下拉框</title><link>https://hessian.cn/p/594.html</link><pubDate>Sun, 01 Jul 2007 09:13:00 +0800</pubDate><guid>https://hessian.cn/p/594.html</guid><description>by GiK&#10;这里面用到了我前面写的那个数据存取对象&#10;&lt;script type="text/javascript"&gt;&#10;function $(o) {&#10;return document.getElementById(o);&#10;}&#10;game = {&#10;code : new String(),&#10;lv    : new Number(),&#10;set   : function(code){&#10;    this.code = code;&#10;    switch(code.substr(0,3)){&#10;        case ‘001’:&#10;            game.lv = 3;&#10;            break;&#10;        case ‘002’:&#10;            game.lv = 2;;&#10;            break;&#10;    }&#10;}&#10;}&#10;&lt;?php&#10;$code = array_flip(LJSConfig::$game_level);&#10;?&gt;&#10;game.set(‘&lt;?= array_shift($code) ?&gt;’);&#10;var server_code = "001002003001";&#10;comboBox = {&#10;    target   : $(‘catbox’),//where to add the selectbox&#10;    sels : new Object(),&#10;        init : function(){&#10;    this.sels.length = new Number(0);&#10;    for(var i=0; i&lt;4; i++){&#10;        this.sels[i] = document.createElement("select");&#10;        this.sels[i].id = "sl" + i;//set element id&#10;        if(i == 0){&#10;        this.sels[i].onchange = function(){&#10;          comboBox.selectChange(this.id.charAt(this.id.length – 1));&#10;          comboBox.hide(game.lv);&#10;        }&#10;        } else {&#10;        this.sels[i].onchange = function(){&#10;          comboBox.selectChange(this.id.charAt(this.id.length – 1));&#10;        }&#10;        }&#10;        this.sels.length++;&#10;        this.target.appendChild(this.sels[i]);&#10;    }&#10;    this.createOptions("0",this.sels[0]);&#10;    this.selectChange(0,1);&#10;    },&#10;        selectChange : function (level)&#10;{&#10;    level = new Number(level); //change type to number&#10;    var selectObj = this.sels[level];&#10;    if(level == 0){&#10;      game.set(selectObj.value);&#10;    }&#10;    if( level &gt;= game.lv )&#10;    {return;}&#10;        var nextSelectObj = this.sels[level+1];&#10;    nextSelectObj.options.length = 0;//clear next select box&#10;    nextSelectObj.style.display = "";&#10;    var currentCode = selectObj.value;&#10;    this.createOptions(currentCode,nextSelectObj);&#10;        if( ( level + 1 ) &lt; game.lv )&#10;      comboBox.selectChange( level + 1 ,nextSelectObj);&#10;},&#10;        createOptions : function( code, sel){&#10;    var datas = code == "0" ? cat.getlevel(1) : cat.getsub( code );&#10;    for(var item in datas)&#10;    {&#10;      if(item != ‘len’)&#10;      {&#10;        var op = document.createElement("option");&#10;        op.text = datas[item].name;&#10;        op.value = item;&#10;        if(server_code &amp;&amp; item == server_code.substr(0,item.length)){&#10;          op.selected = ‘true’;&#10;        }&#10;        sel.options.add( op );&#10;      }&#10;    }&#10;    },&#10;        hide : function(level){&#10;    for(var i = this.sels.length; i &gt; level; i–){&#10;        if(this.sels[i])&#10;         this.sels[i].style.display = "none";&#10;    }&#10;    }&#10;}&#10;comboBox.init();&#10;&lt;/script&gt;&#10;</description></item><item><title>[转] JQUERY中简单使用AJAX</title><link>https://hessian.cn/p/604.html</link><pubDate>Thu, 28 Jun 2007 10:49:00 +0800</pubDate><guid>https://hessian.cn/p/604.html</guid><description> 转自：http://www.cnblogs.com/ewebapp/archive/2006/11/07/jquery-using-ajax.html&#10;JQuery第14天里说到了Ajax:同时给了几个读取数据的例子,jquery没有Prototypre的严谨与规范,但利于普通开发的快速上手,也算是各有千秋吧,要是结合两者,我想更是事倍功倍,虽然说两者加起来快近80K,但这个年代带宽应该不是问题了,AJAXModule&#10;I’m trying something a little different today. It took me a while to figure out why I couldn’t open a free account with YouTube for about 3 weeks but now that it’s all straightened out I thought I’d upload a video where I walk you through some of the basic ways you could use jquery to add AJAX functionality to your site.&#10;The video is short because my understanding of YouTube is that I have to limit the file to 10 minutes. Not everything I’ve said in the tutorial is 100% correct. There are minor mistakes such as the part where I call cgi a “server side script” when it would be more accurate to say “server side language”. Cut me some slack… woodya?英文全文 Demos » AJAX Plugin&#10;Loaded from an HTML File Code:&#10;$("div#html").load("ajax-test.html"); Loaded from an XML File Code:&#10;$.get("ajax-test.xml",function(xml){&#10;var text = $("title",xml).text();&#10;$("div#xml").html("&lt;h1&gt;"+text+"&lt;/h1&gt;");&#10;}); Loaded from a Dynamic HTML File Code:&#10;$("div#dhtml").load("html.cgi",{name:"John"}); Loaded from a Dynamic XML File Code:&#10;$.post("XML.cgi",{&#10;name: "John"&#10;},function(xml){&#10;var text = $("title",xml).text();&#10;$("div#dxml").html("&lt;h2&gt;"+text+"&lt;/h2&gt;");&#10;}); Loaded from a Text File Code:&#10;$.get("ajax-test.txt",function(txt){&#10;$("div#txt").html("&lt;h1&gt;"+txt+"&lt;/h1&gt;");&#10;});</description></item><item><title>【原创】一个简单数据存取的对象</title><link>https://hessian.cn/p/527.html</link><pubDate>Mon, 25 Jun 2007 03:39:00 +0800</pubDate><guid>https://hessian.cn/p/527.html</guid><description>最近刚好要做个有联动的分类选择，就写了下面这个东西，令人郁闷的javascript&#10;cat = {&#10;data : function (code,name,price,discount){&#10;    this.code = code;&#10;    this.name = name;&#10;    this.price = price;&#10;    this.discount = discount;&#10;},&#10;get : function(code){&#10;    if (!code || code.length % 3 != 0 || code.length &lt; 3)&#10;    {&#10;      return false;&#10;    }&#10;    if(cat.getlevel(code.length / 3)[code]){&#10;      return cat.getlevel(code.length / 3)[code];&#10;    } else {&#10;      return false;&#10;    }&#10;},&#10;</description></item><item><title>[转][MS]使用JS读取XML文件</title><link>https://hessian.cn/p/458.html</link><pubDate>Sat, 16 Jun 2007 17:24:00 +0800</pubDate><guid>https://hessian.cn/p/458.html</guid><description>我的xml文件Login.xml如下.&#10;&lt;?xml version="1.0" encoding="utf-8" ?&gt;&#10;&lt;Login&gt;&#10;    &lt;Character&gt;&#10;        &lt;C Text="热血" Value="0"&gt;&lt;/C&gt;&#10;        &lt;C Text="弱气" Value="1"&gt;&lt;/C&gt;&#10;        &lt;C Text="激情" Value="2"&gt;&lt;/C&gt;&#10;        &lt;C Text="冷静" Value="3"&gt;&lt;/C&gt;&#10;        &lt;C Text="冷酷" Value="4"&gt;&lt;/C&gt;&#10;    &lt;/Character&gt;&#10;    &lt;Weapon&gt;&#10;        &lt;W Text="光束剑" Value="0"&gt;&lt;/W&gt;&#10;        &lt;W Text="光束配刀" Value="1"&gt;&lt;/W&gt;&#10;    &lt;/Weapon&gt;&#10;    &lt;EconomyProperty&gt;&#10;        &lt;P Text="平均型" Value="0"&gt;&lt;/P&gt;&#10;        &lt;P Text="重视攻击" Value="1"&gt;&lt;/P&gt;&#10;        &lt;P Text="重视敏捷" Value="2"&gt;&lt;/P&gt;&#10;        &lt;P Text="重视防御" Value="3"&gt;&lt;/P&gt;&#10;        &lt;P Text="重视命中" Value="4"&gt;&lt;/P&gt;&#10;    &lt;/EconomyProperty&gt;&#10;&lt;/Login&gt; 现在我需要对这个xml文件的内容进行操作.&#10;首先,我们需要加载这个xml文件,js中加载xml文件,是通过XMLDOM来进行的.&#10;</description></item><item><title>JavaScript中类的定义[2]</title><link>https://hessian.cn/p/389.html</link><pubDate>Sun, 20 May 2007 22:04:00 +0800</pubDate><guid>https://hessian.cn/p/389.html</guid><description>4.使用prototype原型对象定义类成员 使用prototype对象来定义类成员可以避免每实例化一个对象就创建一次类成员的缺点。　当new一个function时，prototype对象的成员将自动赋给所创建的对象。 Demo2： 是一个JavaScript对象，可以为prototype对象添加、修改、删除方法和属性。从而为一个类添加成员定义。 ＜script language=”JavaScript” type=”text/javascript”＞&#10;＜!– //定义一个只有一个属性caption的类　function cls(){ this.caption=1; } //使用函数的prototype属性给类定义新成员　cls.prototype.showcaption = function(){ alert(this.caption); } //创建cls的一个实例　var obj=new cls(); //调用通过prototype原型对象定义的showcaption方法　obj.showcaption();&#10;//–＞&#10;＜/script＞ prototype&#10;</description></item><item><title>JavaScript中类的定义[3]</title><link>https://hessian.cn/p/606.html</link><pubDate>Sun, 20 May 2007 22:04:00 +0800</pubDate><guid>https://hessian.cn/p/606.html</guid><description>5.较好的自定义类的方式 前面已经介绍了如何定义一个类，如何初始化一个类的实例，且类可以在function定义的函数体中添加成员，又可以用prototype定义类的成员，编程的代码显得混乱。&#10;如何以一种清晰的方式来定义类呢？下面给出了一种类的实现模式。 在JavaScript中，由于对象灵活的性质，在构造函数中也可以为类添加成员，在增加灵活性的同时，也增加了代码的复杂度。&#10;为了提高代码的可读性和开发效率，可以采用这种定义成员的方式，而使用prototype对象来替代，这样function的定义就是类的构造函数，符合传统意义类的实现：类名和构造函数名是相同的。&#10;例如： cls.prototype，不仅代码体积变大，而且易读性还不够。为了进一步改进，可以使用无类型对象的构造方法来指定prototype对象，从而实现类的成员定义： function cls(){ //构造函数&#10;} //成员定义 cls.prototype.someProperty=”sample”; cls.prototype.someMethod=function(){ //方法实现代码 } 虽然上面的代码对于类的定义已经清晰了很多，但每定义一个属性或方法，都需要使用一次&#10;cls，构造函数直接用类名来实现，而成员使用无类型对象来定义，以列表的方式实现了所有属性和方法，并且可以在定义的同时初始化属性的值。这也更象传统意义面向对象语言中类的实现。只是构造函数和类的成员定义被分为了两个部分，这可看成JavaScript中定义类的一种固定模式，这样在使用时会更加容易理解。 //定义一个类cls function cls(){ //构造函数 }&#10;//通过指定prototype对象来实现类的成员定义 class1.prototype={ someProperty:”sample”, someMethod:function(){ //方法代码 }, …//其他属性和方法. } 上面的代码用一种很清晰的方式定义了&#10;注意：在一个类的成员之间互相引用，必须通过this指针来进行，例如在上面例子中的someMethod方法中，如果要使用属性someProperty，必须通过this.someProperty的形式，因为在JavaScript中每个属性和方法都是独立的，它们通过this指针联系在一个对象上。&#10;</description></item><item><title>JavaScript中类的定义</title><link>https://hessian.cn/p/422.html</link><pubDate>Sun, 20 May 2007 22:03:00 +0800</pubDate><guid>https://hessian.cn/p/422.html</guid><description>&#10;      1.类的定义机制 1&gt;用function关键字定义“类“。&#10;2&gt;function内部通过this指针定义“类“的成员。&#10;3&gt;function类似于其他语言中的构造函数(constructor)。&#10;demo1： function cls()&#10;{      this.txt = “111”;      this.display = function(){ alert(“this is a test method”); } } var obj=new cls(); 2.理解用new创建对象的过程&#10;通过new cls()获得对象obj，对象obj便自动获得了属性txt和方法display。</description></item><item><title>JavaScript 不只是脚本</title><link>https://hessian.cn/p/535.html</link><pubDate>Tue, 08 May 2007 10:47:00 +0800</pubDate><guid>https://hessian.cn/p/535.html</guid><description>发一篇关于JavaScript的文章，因为JS或者说这中界面技术太有用了。Hoho&#10;JavaScript似乎一直都当作是解析型的脚本语言，程序开发人员往往对此不懈一顾。认为一个脚本也没有太多的难度，那似乎为不懂程序的人专门设计的东西，不值得真正搞开发的去研究和应用。&#10;</description></item></channel></rss>