上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 215 下一页
摘要: var func = function (callback, a, b, c) { return callback(a, b, c);}var funAdd = function (a, b, c) { function callback(a, b, c) { return a + b + c; } return func(callback, a, b, c);}var funMul = function (a, b, c) { function callback(a, b, c) { return a * b * c; } return func(callbac... 阅读全文
posted @ 2012-03-15 12:37 万一 阅读(1539) 评论(0) 推荐(0) 编辑
摘要: num = 123;str = "123";alert(num == 123); //truealert(str == 123); //truealert(num === 123); //true; 值相同且类型相同alert(str === 123); //falsealert(typeof num === "number"); //truealert(typeof str === "string"); //true//数组的类型也是 objectalert(typeof []); //objectalert(typeof {}); 阅读全文
posted @ 2012-03-15 11:57 万一 阅读(3860) 评论(4) 推荐(0) 编辑
摘要: /* 默认参数 */function func(a, b, c) { a = a === undefined ? 3 : a; //默认 3 b = b === undefined ? 3 : b; //默认 3 c = c === undefined ? 3 : c; //默认 3 return a + b + c;}alert(func(6, 6, 6)); //18alert(func()); //9alert(func(4)); //10alert(func(4, 0)); //7/* 通过闭包预置参数 */function fu... 阅读全文
posted @ 2012-03-15 11:11 万一 阅读(1399) 评论(0) 推荐(0) 编辑
摘要: 在看几个 js 源码; 感觉不如 Delphi 的代码清晰, js 太灵活性, 需慢慢适应./* 定义一组常量(变量) */var MX1 = function () { };MX1.Max = 100;MX1.Min = 0;MX1.Ave = 50;alert(MX1.Max + ", " + MX1.Min + ", " + MX1.Ave); //100, 0, 50alert(++MX1.Max); //101/* 定义一组函数 */var MX2 = function () { };MX2.Add = function (a, b) { re 阅读全文
posted @ 2012-03-15 10:45 万一 阅读(2496) 评论(1) 推荐(0) 编辑
摘要: png 图片:wav 文件: 或:更多格式:123 application/vnd.lotus-1-2-33gp video/3gppaab application/x-authoware-binaam application/x-authoware-mapaas application/x-authoware-segai application/postscriptaif audio/x-aiffaifc audio/x-aiffaiff audio/x-aiffals audio/X-Alpha5amc application/x-mpegani application/oct... 阅读全文
posted @ 2012-03-14 13:28 万一 阅读(32737) 评论(2) 推荐(3) 编辑
摘要: 执行 Application.Terminate 后, OnDestroy 中的代码还会执行, 但不会理会 OnCloseQuery、OnClose 中的代码了.procedure TForm1.Button1Click(Sender: TObject);begin// SendMessage(Application.Handle, WM_CLOSE, 0, 0);// SendMessage(Handle, WM_CLOSE, 0, 0);// Halt(0);// PostQuitMessage(0); Application.Terminate;end;procedure TF... 阅读全文
posted @ 2012-02-14 23:15 万一 阅读(4331) 评论(4) 推荐(0) 编辑
摘要: uses System.IOUtils, System.Types, System.Generics.Collections, System.Generics.Defaults, System.Character;procedure StrArrNumberSort(var Arr: TArray<string>);begin TArray.Sort<string>(Arr, TComparer<string>.Construct( function (const s1,s2: string): Integer var L1,L2: string; ... 阅读全文
posted @ 2012-02-10 15:57 万一 阅读(7319) 评论(1) 推荐(1) 编辑
摘要: 很喜欢 System.Zip; 手头的程序需要把压缩后的一组文件从内存流解压, 这用 System.Zip 非常简单, 但我需要呈现解压进度, 同时给出当前文件名.因此给 System.Zip.TZipFile 添加了一个 OnUnZipProgress 事件.在 System.Zip 的基础上添加了不足 10 行代码, 新加代码都在行尾标记了 ///.修改后的文件(Zip2.pas):unit Zip2;interfaceuses System.SysUtils, System.IOUtils, System.Generics.Collections, System.Classes;... 阅读全文
posted @ 2012-02-04 13:51 万一 阅读(6048) 评论(10) 推荐(2) 编辑
摘要: 当我把一个"结构体"在类中当做属性后, 在实用中可以直接读取结构体成员, 但不能直接写入...下面是由此引发的小练习:unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;type TForm1 = class(TForm) Button1: TButton; Button2: TBut 阅读全文
posted @ 2012-01-05 16:56 万一 阅读(4310) 评论(7) 推荐(3) 编辑
摘要: 在实践中真的会发现更多问题.unit Unit1;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs;type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; IA = Interface function GetName: string; p... 阅读全文
posted @ 2012-01-03 22:09 万一 阅读(2542) 评论(2) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 215 下一页