随笔分类 - JavaScript
摘要:开发工具目录结构--E:\develop\----node-webkit-v0.9.2-win-ia32----Sublime Text 2.0.2 x64为Sublime text2构建Build环境打开sublime text2 菜单->tools->build system->new buil...
阅读全文
摘要:说明在HTML中上传文件时会为文件内容加入一头一尾,使用浏览器自带的调试工具可看到请求头中有Request Payload数据如下所示:-----------------------8cc0b8cfcfd5ed2Content-Disposition: form-data; name="file"; filename="item3.xml"Content-Type: application/octet-stream这里是真正的文件内容-----------------------8cc0b8cfcfd5ed2--因此服务端接收后要手动对其作解析。代码网页
阅读全文
摘要:导入js文件时使用”charset“参数设置js保存时的编码格式ajax请求时使用”scriptCharset“参数设置服务器提供的数据的正确编码格式 $.ajax({ async: true, data: formdata, dataType: "jsonp", scriptCharset: "UTF-8", jsonp: "callback", type: "get",
阅读全文
摘要:- null是关键字;undefined是Global对象的一个属性。 - null是对象(空对象, 没有任何属性和方法);undefined是undefined类 型的值。试试下面的代码: document.writeln(typeof null); document.writeln(typeof undefined); - 对象模型中,所有的对象都是Object或其子类的实例,但null对象例外: document.writeln(null instanceof Object); - null“等值(==)”于undefined,但不“全等...
阅读全文
摘要:函数定义方式(注意function与Functioin的大小写区别): 第1种:function f(p1,p2) { return p1+p2; } 第2种:var f = function (p1,p2) { return p1+p2; } 第3种:var f = new Function (p1,p2) { return p1+p2; } 作用:以上3种方式都可使f成为一段可执行的脚本对象,即函数。 可通过"alert (f);"将f的函数体在屏幕上弹出。 又可通过f(参数1,参数2)的形式得到函数的运行的结果。类对象的定义方式(注意是f...
阅读全文