首页 DOJO-API中文参考手册附加注解实例

DOJO-API中文参考手册附加注解实例

举报
开通vip

DOJO-API中文参考手册附加注解实例DOJO-API 中文参考手册,附加注解实例 Dojo 体系架构总体上来看是一个分层的体系架构,最下面的一层是包系统,Dojo API 的结构与 Java 很类似,它把所有的 API 分成不 同的包(package),当您要使用某个 API 时,只需导入这个 API 所在的包。包系统上面一层是语言库,这个语言库里包含一些语言工具 API,类似于 Java 的 util 包。再上一层是环境相关包,这个包的功能是处理跨浏览器的问题。Dojo 体系架构图 Dojo 大部分代码都位于应用程序支持库,由于太小限制,图中没...

DOJO-API中文参考手册附加注解实例
DOJO-API 中文参考手册,附加注解实例 Dojo 体系架构总体上来看是一个分层的体系架构,最下面的一层是包系统,Dojo API 的结构与 Java 很类似,它把所有的 API 分成不 同的包(package),当您要使用某个 API 时,只需导入这个 API 所在的包。包系统上面一层是语言库,这个语言库里包含一些语言工具 API,类似于 Java 的 util 包。再上一层是环境相关包,这个包的功能是处理跨浏览器的问题。Dojo 体系架构图 Dojo 大部分代码都位于应用程序支持库,由于太小限制,图中没有列出所有的包。开发人员大部分时候都在调用这个层中的 API,比如,用 IO 包可以进行Ajax 调用。 最上面的一层是 Dojo 的 Widget 系统,Widget 指的是用户界面中的一个元素,比如按钮、进度条和树等。 Dojo 的 Widget 基于 MVC 结构。它的视图作为一个 Template(模板)来进行存放,在 Template 中放置着 HTML 和 CSS 片段,而控制器来对该 Template 中的元素进行操作。 Widget 不仅支持自定义的样式 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf ,并且能够对内部元素的事件进行处理。用户在页面中只需要加入简单的标签就可以使用。在这一层中,存在数百个功能强大的 Widget 方便用户使用,包括表格、树、菜单等。 常用包介绍 Dojo 1.1.1 提供了上百个包,这些包分别放入三个一级命名空间:Dojo,Dijit和 DojoX 。其中 Dojo 是核心功能包 , Dijit 中存放的是 Dojo 所有的Widget 组件,而 DojoX 则是一些扩展或试验功能,DojoX 中的试验功能在成熟之后有可能在后续版本中移入到 Dojo 或 Dijit 命名空间中。 由于 Dojo 包种类繁多,下面只列举了最常用的一些包及其功能,以方便读者有个初步了解或供以后查阅。 包名 功能 dojo.io 不同的 IO 传输方式。 script、IFrame 等等; dojo.dnd 拖放功能的辅助 API 。 dojo.string 这个包可以对字符串进行如下的处理:修整、转换为大写、 编码、esacpe、填充(pad)等等; dojo.date 解析日期格式的有效助手; dojo.event 事件驱动的 API,支持 AOP 开发,以及主题 / 队列的功能; dojo.back 用来撤销用户操作的栈管理器; dojo.rpc 与后端服务(例如理解 JSON 语法的 Web 服务)进行通信; dojo.colors 颜色工具包; dojo.data Dojo 的统一数据访问接口,可以方便地读取 XML、JSON 等不同格式的数据文件; dojo.fx 基本动画效果库; dojo.regexp 正则表达式处理函数库; dijit.forms 表单控件相关的 Widget 库; dijit.layout 页面布局 Widget 库; dijit.popup 这个包用于以弹出窗口方式使用 Widget ; dojox.charting 用于在页面上画各种统计图表的工具包; dojox.collections 很有用的集合数据结构(List、Query、Set、Stack、Dictionary...); dojox.encoding 实现加密功能的 API(Blowfish、MD5、Rijndael、SHA...); dojox.math 数学函数(曲线、点、矩阵); dojo.reflect 提供反射功能的函数库; dojox.storage 将数据保存在本地存储中(例如,在浏览器中利用 Flash的本地存储来实现); dojox.xml XML 解析工具包; djConfig 是 dojo 内置的一个全局设置对象,其作用是可以通过其控制 dojo 的行为 首先我们需要在引用 dojo.js 前声明 djConfig 对象,以便在加载 dojo.js 的时候才能够取得所设置的值,虽然在 0.3 版本以后 dojo 支持在加载后设置,但是强烈建议你把声明 djConfig 的代码作为第一段 script 一个完整的 djConfig 对象定义如下(值均为 dojo 的默认值) isDebug 是一个很有用的属性,顾名思义,如果设置为真,则所有 dojo.Debug 的输出有效,开发时应该设置为 true,发布时应 该设置为 false debugContainerId 同样也是与调试有关的,如果不指定的话,调试信息将会直接利用 document.write 输出,这样可能会破坏页 面的整体布局,所以你可以指定任何一个可以作为容器的 html 元素的 id 作为调试信息输出容器 allowQueryConfig,这个属性指明 dojo 是否允许从页面 url 的参数中读取 djConfig 中的相关属性,当值为 true 时,dojo 会优先 从 url 参数中读取 djConfig 的其他属性,比如: http://server/dojoDemo.htm?djConfig.debugContainerId=divDebug baseScriptUri,一般不需要设置,dojo 会自动根据你引用 dojo.js 的路径设置这个值,比如,,自动获取的值便是 ../dojo/ ps: 如果你有多个工程需要同时引用 dojo.js 的话,建议也把 dojo 当作一个独立的工程,引用的时候采用绝对路径就可以了 parseWidgets,这个是可以控制 dojo 是否自动解析具有 dojoType 的 html 元素为对应的 widget,如果你没有使用任何 Widget, 建议设置为 false 以加快 dojo 的加载速度 searchIds,这是一个字符串数组,定义了所有需要解析为 widget 的 html 元素的 ID,如果 ID 不在其中的 html 元素是不会被解 析的,当数组为空数组时,则所有具有 dojoType 的元素都会被解析 还有一个 bindEncoding,是用来设置默认的 bind 请求的编码方式 至于其它的属性,不是用处不大,就是不知道有什么作用 在实际开发中,可以把 djConfig 的定义放在一个 js 文件里,并将其作为第一个引用的 js 文件,这样应该是最方便的。 preventBackButtonFix 在 djConfig 中设置 preventBackButtonFix: false。这样保证了隐藏的表单 (hidden IFRAME)将会添加到页面当中,如果不加入这段,dojo.undo.browser 不会正常工 作。 译者注:设置 方法 快递客服问题件处理详细方法山木方法pdf计算方法pdf华与华方法下载八字理论方法下载 就是在 header 中加入如下代码: djConfig 是 dojo 内置的一个全局设置对象,其作用是可以通过其控制 dojo 的行为 首先我们需要在引用 dojo.js 前声明 djConfig 对象,以便在加载 dojo.js 的时候才能够取得所设置的值, 虽然在 0.3 版本以后 dojo 支持在加载后设置,但是强烈建议你把声明 djConfig 的代码作为第一段 s cript 一个完整的 djConfig 对象定义如下(值均为 dojo 的默认值) var djConfig = { isDebug: false, debugContainerId: "", allowQueryConfig: false, bases criptUri: "", parseWidgets: true searchIds: [], baseRelativePath: "", librarys criptUri: "", iePreventClobber: false, ieClobberMinimal: true, preventBackButtonFix: true, }; isDebug 是一个很有用的属性,顾名思义,如果设置为真,则所有 dojo.Debug 的输出有效,开发时应该 设置为 true,发布时应该设置为 false debugContainerId 同样也是与调试有关的,如果不指定的话,调试信息将会直接利用 document.write 输出, 这样可能会破坏页面的整体布局,所以你可以指定任何一个可以作为容器的 html 元素的 id 作为调试信息 输出容器 allowQueryConfig,这个属性指明 dojo 是否允许从页面 url 的参数中读取 djConfig 中的相关属性,当值为 true 时,dojo 会优先从 url 参数中读取 djConfig 的其他属性,比 如: http://server/dojoDemo.htm?djConfig.debugContainerId=divDebug bases criptUri,一般不需要设置,dojo 会自动根据你引用 dojo.js 的路径设置这个值,比如,,自动获取的值便是 ../dojo/ ps: 如果你有多个工程需要同时引用 dojo.js 的话,建议也把 dojo 当作一个独立的工程,引用的时候采用 绝对路径就可以了 parseWidgets,这个是可以控制 dojo 是否自动解析具有 dojoType 的 html 元素为对 应的 widget,如果你没有使用任何 Widget,建议设置为 false 以加快 dojo 的加载速度 searchIds,这是一个字符串数组,定义了所有需要解析为 widget 的 html 元素的 ID,如果 ID 不在其中的 html 元素是不会被解析的,当数组为空数组时,则所有具有 dojoType 的元素都会被解析 至于其它的属性,不是用处不大,就是不知道有什么作用 在实际开发中,可以把 djConfig 的定义放在一个 js 文件里,并将其作为第一个引用的 js 文件,这样应该 是最方便的。 实现功能:在一个容器里点击一个链接,在另外一个容器中显示这个链接所指向页面的 内容 财务内部控制制度的内容财务内部控制制度的内容人员招聘与配置的内容项目成本控制的内容消防安全演练内容

Example on how to easily relay clicks

Link 1
Link 2
Link 3
dojo.addOnLoad 可以加载指定函数到 window.load 时执行,好处就是可以很方便的在 window.load 时执行多个函数 Usage Example: dojo.addOnLoad(init); //init 是一个函数 dojo.addOnLoad(myObject, init); //init 是 myObject 对象的一个方法 dojo.require 如果你想调用一个模块的对象的时候,你应该首先用 dojo.require 来请求这个模块,dojo 会根据你的请求自动取得相应的 js 文 件,并加载到内存中,这样你才能调用或创建其中的对象   dojo 会自动维护已加载的模块列表,所以是不会重复加载模块的 Usage Example: dojo.require("dojo.event"); dojo.requireIf=dojo.requireAfterIf   可以根据指定的条件来决定是否加载指定的模块   Usage Example: dojo.requireIf(dojo.html.ie, "dojo.html"); //如果 dojo.html.ie 为 true,才会加载 dojo.html 模块 dojo.provide 除非你要开发自己的模块,不然是用不到这个方法的,你可以这句看成是向系统注册这个模块名称   Usage Example: dojo.provide("dojo.custom"); dojo.exists 判断指定对象是否具有指定名称的方法   Usage Example: dojo.exists(dojo, "exists"); //will return true 模块:dojo.io.IO dojo.io.bind 处理请求取回需要的数据并处理 这个函数是 AJAX 中最为重要和有用的函数,dojo.io.bind 这个类是用来处理客户端与服务器 间通讯的,需要通讯的参数由对象 dojo.io.Request 所定义,具体通讯的方法则由另外一个对 象 Transport 所提供。 因此,我们如果需要与服务器通讯,则应该定义一个 Request 对象, 其中包括服务器地址及回调函数,例子中 Requset 都是以匿名对象方式定义的 虽然我们可以定义一个自己的 Transport,但是显然不如直接利用现成的 Transport 方便。 Dojo 里提供了一个同时兼容 IE 和 Firefox 的 dojo.io.XMLHTTPTransport,但是这个对象位于 dojo.io.BrowserIO,因此,一般 require dojo.io.IO 时,还应该 require dojo.io.BrowserIO Usage Example dojo.io.bind({ url: "http://localhost/test.html", //要请求的页面地址 mimetype: "text/html", // 请 求 的 页 面 的 类 型 , 应 该 设 置 为 与 你 请 求 页 面 类 型 对 应 的 mimetype,默认为 "text/plain" method:"GET", //默认为"GET" sync: false, //默认为异步执行 useCache: false, //默认为不使用页面缓存,注意这里的缓存并不是浏览器的缓存,而是 Dojo 自身所维护的页面缓存 preventCache: false, //默认为启用浏览器缓存,否则将通过自动增加不同的参数来确保浏 览器缓存失效 timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 load: function(type, data, evt) { alert(data); }, //type should be "load", data is that we wanted error: function(type, error) { alert(error.message); }, //error is dojo.io.Error timeout: function(type) { alert("请求超时!"); } }); 你也可以用一个 handle 来处理所有的事件 dojo.io.bind({ url: "http://localhost/test.html", //要请求的页面地址 mimetype: "text/html", // 请 求 的 页 面 的 类 型 , 应 该 设 置 为 与 你 请 求 页 面 类 型 对 应 的 mimetype timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 handle: function(type, data, evt){ if(type == "load") { alert(data); } //data is that we wanted else if (type == "error") { alert(data.message); } //data is the error object else { ; } //other events maybe need handled } }); 如果没有在 Request 中指定所用的 transport,则 Dojo 会自动的在已注册的 transports 中寻 找能够处理这个 Request 的 transport,如果不能找到,则返回指定的 Request。下面是一个 指定了 transport 的例子: dojo.io.bind({ url: "http://localhost/test.html", //要请求的页面地址 mimetype: "text/html", // 请 求 的 页 面 的 类 型 , 应 该 设 置 为 与 你 请 求 页 面 类 型 对 应 的 mimetype timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 transport: "XMLHTTPTransport", load: function(type, data, evt) { alert(data); }, //type should be "load", data is that we wanted error: function(type, error) { alert(error.message); }, //error is dojo.io.Error timeout: function(type) { alert("请求超时!"); } }); 你还可以利用 bind 来得到一个 Javas cript 所定义的对象(注意 mimetype 必须要定义为 "text/javas cript") testObj = dojo.io.bind({ url: "http://localhost/test.js", //test.js 里定义了一个对象 mimetype: "text/javas cript", //请求的页面的类型,应该设置为与你请求页面类型对应的 mimetype timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 handle: function(type, data, evt){ if(type == "load") { alert(data); } //data is a object or value else if (type == "error") { alert(data.message); } //data is the error object else { ; } //other events maybe need handled } }); 下面是一个 Post 的例子: dojo.io.bind({ url: "http://localhost/test.aspx", //要提交的页面地址 mimetype: "text/html", //请求的页面的类型,应该设置为与你请求页面类型对应的 mimetype timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 method: "POST", formNode: dojo.byId("myForm"), //指定提交的 Form 名称 load: function(type, data, evt) { alert(data); }, //type should be "load", data is that we wanted error: function(type, error) { alert(error.message); }, //error is dojo.io. Error timeout: function(type) { alert("请求超时!"); } }); 另一个 Post 的例子(without Form to post): dojo.io.bind({ url: "http://localhost/test.aspx", //要提交的页面地址 mimetype: "text/html", // 请 求 的 页 面 的 类 型 , 应 该 设 置 为 与 你 请 求 页 面 类 型 对 应 的 mimetype timeoutSeconds: 3000, //3 秒后超时,如果为 0 则永不超时 method: "POST", content: {a: 1, b: 2}, //要提交的数据 load: function(type, data, evt) { alert(data); }, //type should be "load", data is that we wanted error: function(type, error) { alert(error.message); }, //error is dojo.io.Error timeout: function(type) { alert("请求超时!"); } }); dojo.io.queueBind 有时,我们需要一次发出多个网页请求,则应该使用 dojo.io.queueBind,因为浏览器可能 只允许同时发出有限个数的请求,如果是使用 dojo.io.bind 的话,则有可能会申请不到新的 XMLHttp 对象而导致出错。 用法与 dojo.io.bind 是一样的。 dojo.io.argsFromMap 用来把对象转换为 URL 的参数形式 Usage Example: dojo.io.argsFromMap({a:1,b:2,c:3}); //will return "c=3&b=2&a=1" dojo.io.argsFromMap({name:"名称",value:"值 "},"utf"); //will return "value=å\u8364X¼&name=å��称&", 有中文的话应该指定 utf 格式,否则 dojo.string.encodeAscii 返回的编码是很怪异的 dojo.io.argsFromMap({a:1,b:2,c:3}, "utf", "c"); //will return "b=2&a=1&c=3",最后一个参 数可以控制指定名称的值出现在最后 dojo.io.setIFrameSrc 设置 IFrame 的 Src Usage Example: dojo.io.setIFrameSrc(dojo.byId("myFrame"), "http://localhost/test.htm"); //myFrame 打 开指定的网页 dojo.io.setIFrameSrc(dojo.byId("myFrame"), "http://localhost/test.htm", true); //myFra me 打开指定的网页,并覆盖浏览器的历史 记录 混凝土 养护记录下载土方回填监理旁站记录免费下载集备记录下载集备记录下载集备记录下载 模块:dojo.io.BrowserIO 基本上就提供了 dojo.io.XMLHTTPTransport 这个对象 XMLHTTPTransport 一般能够满足我们的需求,但是其有几个限制:它不能传输文件,不能够成功执行 跨域名的远程请求,并且不支持 file:// 这样的 协议 离婚协议模板下载合伙人协议 下载渠道分销协议免费下载敬业协议下载授课协议下载 因此,根据应用要求,我们可能会需要选用其它的 transport: dojo.io.IframeTransport, dojo.io.repubsubTranport, dojo.io.s criptSrcTransport, ShortBusTransport dojo.io.IframeTransport,用法与 xmlhttp 是一样的,其优点就是可以跨域,不存在任何的安全问题 如果 Request 指定的 mimetype 是 text 或 javas cript,返回的内容应该是放在第一个 textarea 里的 内容,如果指定的 mimetype 是 html,则 IFrame 里的 html 则是需要的内容。因为浏览器兼容的原因, IframeTransport 不能正确处理返回类型为 XML 的请求。 关于 Rpc,这个类似于 Remoting 的东西,也将在以后对其进行介绍。 模块:dojo.string.extras 模块:dojo.string.common 模块:dojo.string dojo.string.common 和 dojo.string 是一样的,只要 require 其中一个就可以使用以下方法 dojo.string.capitalize 把每一个单词的首字母大写 Usage Example: dojo.string.capitalize("show me love"); //will return "Show Me Love" dojo.string.isBlank 判断输入字符串是否为空或全是空白字符,如果传入对象为非字符串则也会返回 true Usage Example: dojo.string.isBlank(" 1 "); //will return false dojo.string.escape 参数 1 为 type,可传值为: xml/html/xhtml, sql, regexp/regex, javas cript/js cript/js, ascii 将按照所传 type 对字符串进行编码 Usage Example: dojo.string.escape("html", ""); //will return "" dojo.string.encodeAscii dojo.string.escapeXml dojo.string.escapeSql dojo.string.escapeRegExp dojo.string.escapeJavas cript dojo.string.escapeString 这些函数也就是 dojo.string.escape 所调用的,这里无需多说 dojo.string.summary 取得输入字符串的缩略版本 Usage Example: dojo.string.summary("1234567890", 5); //will return "12345..." dojo.string.endsWith 判断输入字符串是否以指定的字符串结尾 Usage Example: dojo.string.endsWith("abcde", "E"); //will return false dojo.string.endsWith("abcde", "E", true); //will return true dojo.string.endsWithAny 判断输入字符串是否以指定的任意字符串结尾 Usage Example: dojo.string.endsWithAny("abcde", "E", "e"); //will return true dojo.string.startsWith 判断输入字符串是否以指定的字符串开头 Usage Example: dojo.string.startsWith("abcde", "A"); //will return false dojo.string.startsWith("abcde", "A", true); //will return true dojo.string.startsWithAny 判断输入字符串是否以指定的任意字符串开头 Usage Example: dojo.string.startsWithAny("abcde", "A", "a"); //will return true dojo.string.has 判断输入字符串是否含有任意指定的字符串 Usage Example: dojo.string.has("abcde", "1", "23", "abc"); //will return true dojo.string.normalizeNewlines 按要求转换回车换行的格式 Usage Example: dojo.string.normalizeNewlines("a\r\nb\r\n", "\r"); //will return "a\rb\r" dojo.string.splitEscaped 将字符串按分隔符转换为数组 Usage Example: dojo.string.splitEscaped("a\\_b_c", '_'); //will return ["a\\_b", "c"] dojo.string.trim 去掉字符串的空白 dojo.require("dojo.string"); defined in dojo/string.js This version of trim() was taken from Steven Levithan’s blog. The short yet performant version of this function is dojo.trim(), which is part of Dojo base. Usage var foo=dojo.string.trim(str: String); (view source) str parameter type String description Usage Example: s = " abc "; dojo.string.trim(s); //will return "abc" dojo.string.trim(s, 0);//will return "abc" dojo.string.trim(s, 1);//will return "abc " dojo.string.trim(s, -1);//will return " abc" dojo.string.trimStart 去掉字符串开头的空白 Usage Example: s = " abc ";dojo.string.trimStart(s); //will return "abc " dojo.string.trimEnd 去掉字符串结尾的空白 Usage Example: s = " abc ";dojo.string.trimEnd(s); //will return " abc" dojo.string.repeat 生成由同一字符(串)重复组成的字符串 Usage Example: dojo.string.repeat("a", 4); //will return "aaaa" dojo.string.repeat("1234", 3, "-"); //will return "1234-1234-1234" dojo.string.pad 使用字符补齐字符串 dojo.require("dojo.string"); defined in dojo/string.js Pad a string to guarantee 保证 that it is at least 最小的 size length by filling 装填 with the character ch at either the start or end of the string. Pads at the start, by default. Usage var foo=dojo.string.pad(text: String, size: Integer, ch: String?, end: Boolean?); parameter type description text size ch end String the string to pad Integer length to provide padding String Optional. character to pad, defaults to ‘0’ Boolean Optional. adds padding at the end if true, otherwise pads at start Usage Example: dojo.string.pad("100", 6);//will return "000100" dojo.string.pad("100", 6, "0", 1);//will return "000100" dojo.string.pad("100", 6, "0", -1);//will return "100000" dojo.string.padLeft 使用字符补齐字符串开头 Usage Example: dojo.string.padLeft("100", 6); //will return "100000" dojo.string.padRight 使用字符补齐字符串结尾 Usage Example: dojo.string.padRight("100", 6); //will return "100000" dojo.string.substituteParams dojo.string.substitute 类似 C#中的 String.Format 函数 %{name}要保证与传入的对象的名称大小写一致,否则会出异常 dojo.require("dojo.string"); defined in dojo/string.js For example, dojo.string.substitute("File '${0}' is not found in directory '${1}'.",["foo.html","/temp"]); dojo.string.substitute("File '${name}' is not found in directory '${info.dir}'.", {name: "foo.html", info: {dir: "/temp"}}); both return "File 'foo.html' is not found in directory '/temp'." Usage var foo=dojo.string.substitute(template: String, map: Object|Array, transform: Function?, thisObject: Object?); parameter type description template String a string with expressions in the form ${key} to be replaced or ${key:format} which specifies a format function. map Object|Array hash to search for substitutions transform Function thisObject Object Usage Example: Optional. a function to process all parameters before substitution takes place, e.g. dojo.string.encodeXML Optional. where to look for optional format function; default to the global namespace dojo.string.substituteParams("%{0} - %{1} - %{2}", "a", "b", "c"); //will return "a - b - c" dojo.string.substituteParams("%{name}: %{value}", {name:"名称",value:"值"}); //will return "名称: 值" 模块:dojo.lang.common / dojo.lang dojo.lang.common 和 dojo.lang 是一样的,只要 require 其中一个就可以使用以下方法 dojo.lang.inherits dojo.inherits dojo.inherits = dojo.lang.inherits; function(/*Function*/subclass, /*Function*/superclass){ // summary: Set up inheritance 继承 between two classes. dojo.lang.mixin dojo.mixin dojo.mixin = dojo.lang.mixin; 将一个对象的方法和属性增加到另一个对象上 Usage Example: var s1 = {name: "TestObj", test1: function(){alert("this is test1!");}} var s2 = {value: 1000, test2: function(){alert("this is test2!");}} var d = {}; dojo.lang.mixin(d, s1, s2); //执行后 d 就具备了 s1 和 s2 的所有属性和方法 d.test1(); dojo.lang.extend dojo.extend dojo.extend = dojo.lang.extend; 为指定类的原型扩展方法与属性 function(/*Object*/ constructor, /*Object...*/ props){ // summary: //Adds all properties and methods of props to constructor's //prototype, making them available to all instances created with //constructor. Usage Example: TestClass = function() {}; dojo.lang.extend(TestClass, {name: "demo", test: function(){alert("Test!");}}); var o = new TestClass(); //TestClass 本来是没有 test 方法的,但是 extend 以后就有 test 方法了 o.test(); dojo.lang.find dojo.lang.indexOf dojo.lang.indexOf = dojo.lang.find; dojo.lang.find = function(/*Array*/ array, /*Object*/ value, /*Bollean*/ indentity, /*Boolean*/ findLast) // summary: // Return the index of value in array, returning -1 if not found. // array: just what you think // value: the value to locate // identity: // // If true, matches with identity comparison (===). If false, uses normal comparison (==). // findLast: // // // If true, returns index of last instance of value. // examples: find(array,value[, identity [findLast]]) // recommended find(value, array[, identity [findLast]]) // deprecated // support both (array, value) and (value, array) 查找指定对象在指定数组中的位置 返回值在数组中的索引值,-1 为未发现。 Indentity 为 true 匹配模式为(===),反正为(==) findLast 为 true 返回最后一个匹配值的索引。 Usage Example: var arr = [1,2,3,3,2,1];dojo.lang.find(arr, 2);//will return 1 dojo.lang.find(arr, 2, true);//will return 1 dojo.lang.find(arr, "2", true);//will return -1 dojo.lang.find(arr, "2", false);//will return 1 dojo.lang.find(arr, 2, true, true); //will return 4 dojo.lang.findLast dojo.lang.lastIndexOf dojo.lang.lastIndexOf = dojo.lang.findLast; function(/*Array*/array, /*Object*/value, /*boolean?*/identity){ // summary: // // // // // Return index of last occurance of value in array, returning -1 if not found. This is a shortcut for dojo.lang.find() with a true value for its "fin
本文档为【DOJO-API中文参考手册附加注解实例】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_495784
暂无简介~
格式:doc
大小:662KB
软件:Word
页数:56
分类:互联网
上传时间:2013-11-05
浏览量:110