dojo.date.getIsoWeekOfYear
dojo.date.getIsoWeekOfYear (/*Date*/dateObject, /*Number*/firstDay) 模块:dojo.data
模块:dojo.validate.datetime dojo.validate.isValidTime
dojo.validate.isValidTime(value, flags);
Validates a time value in any International format.
The value can be validated against one format or one of multiple formats. Format h hh H HH m mm s ss
12 hour, no zero padding. 12 hour, has leading zero. 24 hour, no zero padding. 24 hour, has leading zero. minutes, no zero padding. minutes, has leading zero. seconds, no zero padding. seconds, has leading zero.
All other characters must appear literally in the expression. Example
\‐> 2:5:33 PM \‐> 14:05:33 @param value A string. @param flags An object. flags.format A string or an array of strings. Default is \flags.amSymbol The symbol used for AM. Default is \flags.pmSymbol The symbol used for PM. Default is \@return true or false
dojo.validate.is24HourTime is24HourTime(value):
is24HourTime accepts a parameter, and determines if it is a valid 24 hour time. value:
value to test. returns: Boolean
Validates 24-hour military time format.
Zero-padding is required for hours, minutes, and seconds. Seconds are optional. @param value A string. @return true or false dojo.validate.is12HourTime is12HourTime(value):
is12HourTime accepts a parameter, and determines if it is a valid 12 hour time. value:
value to test. returns: Boolean
Validates 12-hour time format.
Zero-padding is not allowed for hours, required for minutes and seconds. Seconds are optional.
@param value A string. @return true or false dojo.validate.isValidDate
isValidDate(dateValue, format):
isValidate determines if a date is valid under the specified format, or a default format of MM/DD/YYYY if not is specified. dateValue:
value to test. format:
format to test
Accepts many format types, including ISO8601 and RFC3339. Al characters in the format string are treated literally except the
following tokens: YYYY - matches a 4 digit year M - matches a non zero-padded month MM - matches a zero-padded month D
- matches a non zero-padded date DD - matches a zero-padded date DDD - matches an ordinal date, 1-365, and 366 on
leapyear ww - matches week of year, 1-53 d - matches day of week, 1-7 Examples: These are all equivalent to October 19, 2005:
Date Format 2005-W42-3 YYYY-Www-d 2005-292 YYYY-DDD 20051019 YYYYMMDD 10/19/2005 M/D/YYYY 19.10.2005 D.M.YYYY returns: boolean
模块:dojo.validate.web dojo.validate.isIpAddress isIpAddress(value):
isIpAddress accepts a parameter, and determines if it is a valid IP address. (IPv6 is not currently supported) value:
value to test. returns: Boolean
dojo.validate.isUrl isUrl(value):
isUrl accepts a parameter, and determines if it is a valid url, based on either a domain name or IP address. (IPv6 is not currently supported) value:
value to test. returns: boolean
dojo.validate.isEmailAddress
isEmailAddress(value, allowLocal, allowCruft):
isEmailAddress determines if value is an email address, with various levels of strictness in its validation. value:
value to test. allowLocal:
boolean. if true, values such as foo@localhost will return true. allowCruft:
boolean. if true, values such as mailto:foo@dojotoolkit.org and
dojo.validate.isEmailAddressList
isEmailAddressList(value, allowLocal, allowCruft):
isEmailAddress determines if a list of potential values are email addresses, with various levels of strictness in its validation. value:
comma separated list of values to test. allowLocal:
boolean. if true, values such as foo@localhost will return true. allowCruft:
boolean. if true, values such as mailto:foo@dojotoolkit.org and
dojo.validate.getEmailAddressList
summary: Check if value is an email address list. If an empty list is returned, the value didn't pass the test or it was empty. value: A string
flags: An object (same as dojo.validate.isEmailAddressList) 模块:dojo.validate.us
dojo.validate.us.isCurrency
isCurrency accepts a parameter, and determines if it is a valid US currency.
Supports optional plus/minus sign, optional dollar-sign, optional cents, optional commas. value:
value to test. returns: boolean
dojo.validate.us.isPhoneNumber
dojo.validate.us.isPhoneNumber(“314-1234-234”);
isPhoneNumber accepts a parameter, and determines if it is a valid US
phone number. Support 4 common separators (none, space, -, and .). Need to add support for extensions. value:
value to test. returns: boolean
dojo.validate.us.isSocialSecurityN umber
isSocialSecurityNumber(value):
isSocialSecurityNumber accepts a parameter, and determines if it is a valid US Social Security Number. Supports space, -, or no separator. value:
value to test. returns: boolean
dojo.validate.us.isZipCode isZipCode(value):
isZipCode accepts a parameter, and determines if it is a valid US zip code.
Supports space, -, or no separator between base and optional +4 portion of US zip code. value:
value to test. returns: boolean
dojo.validate.us.isState
isState accepts a two character parameter, and determines if it is a valid postal abbreviation for a US state or territory. value:
value to test, 2 digit character representing a postal abbreviation. returns: boolean
模块:dojo.dom dojo.dom.isNode
dojo.dom.isNode (/* object */wh) summary: //
checks to see if wh is actually a node. 测试指定对象是否为节点 Usage Example:
dojo.dom.isNode(dojo.byId('edtTitle')); dojo.dom.getUniqueId
//summary:
//returns a unique string for use with any DOM element 取得唯一 id Usage Example:
dojo.dom.getUniqueId(); //will return dj_unique_# dojo.dom.firstElement
dojo.dom.getFirstChildElement
function(/* Element */parentNode, /* string? */tagName) 取得指定节点下的第一个满足指定 Tag 条件的子节点 Usage Example:
dojo.dom.firstElement(parentNode, 'SPAN');
dojo.dom.firstElement = dojo.dom.getFirstChildElement dojo.dom.lastElement
dojo.dom.getLastChildElement
function(/* Element */parentNode, /* string? */tagName) // summary: //
returns the last child element matching tagName 取得指定节点下的最后一个满足指定 Tag 条件的子节点 Usage Example:
dojo.dom.lastElement(parentNode, 'SPAN'); dojo.dom.nextElement
dojo.dom.getNextSiblingElement
function(/* Node */node, /* string? */tagName) returns the next sibling element matching tagName
dojo.dom.nextElement = dojo.dom.getNextSiblingElement 取得指定节点的下一个满足指定 Tag 条件的子节点 Usage Example:
dojo.dom.nextElement(node, 'SPAN'); dojo.dom.prevElement
dojo.dom.getPreviousSiblingElement
function(/* Node */node, /* string? */tagName)
returns the previous sibling element matching tagName
dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement 取得指定节点的前一个满足指定 Tag 条件的子节点 dojo.dom.prevElement(node, 'SPAN'); dojo.dom.moveChildren
function(/*Element*/srcNode, /*Element*/destNode, /*boolean?*/trim) summary: // //
Moves children from srcNode to destNode and returns the count of children moved; will trim off text nodes if trim == true
把指定节点下的所有子节点移动到目标节点下,并返回移动的节点数 Usage Example:
dojo.dom.moveChildren(srcNode, destNode, true); //仅移动子节点,srcNode 中的文字将被丢弃 dojo.dom.moveChildren(srcNode, destNode, false);//包括文字和子节点都将被移动到目标节点下 dojo.dom.copyChildren
function(/*Element*/srcNode, /*Element*/destNode, /*boolean?*/trim) summary: // //
Copies children from srcNde to destNode and returns the count of children copied; will trim off text nodes if trim == true 把指定节点下的所有子节点复制到目标节点下,并返回复制的节点数
dojo.dom.copyChildren(srcNode, destNode, true); //仅复制子节点,srcNode 中的文字将被忽略 dojo.dom.copyChildren(srcNode, destNode, false);//包括文字和子节点都将被复制到目标节点下 dojo.dom.replaceChildren
function(/*Element*/node, /*Node*/newChild)
summary: // //
Removes all children of node and appends newChild. All the existing children will be destroyed.
// FIXME: what if newChild is an array‐like object? 用指定的新节点替换父节点下的所有子节点 Usage Example:
dojo.dom.replaceChildren(node, newChild); //目前还不支持 newChild 为数组形式 dojo.dom.removeChildren function(/*Element*/node)
removes all children from node and returns the count of children removed. // //
The children nodes are not destroyed. Be sure to call destroyNode on them after they are not used anymore.
删除指定节点下的所有子节点,并返回删除的节点数 Usage Example:
dojo.dom.removeChildren(node); dojo.dom.replaceNode
function(/*Element*/node, /*Element*/newNode) // summary: // // //
replaces node with newNode and returns a reference to the removed node. To prevent IE memory leak, call destroyNode on the returned node when it is no longer needed. dojo.dom.destroyNode function(/*Node*/node) summary: // // //
destroy a node (it can not be used any more). For IE, this is the right function to call to prevent memory leaks. While for other browsers, this is identical to dojo.dom.removeNode 用指定的新节点替换父节点下的所有子节点 Usage Example:
dojo.dom.replaceChildren(node, newChild); //目前还不支持 newChild 为数组形式 dojo.dom.removeNode function(/*Node*/node) summary: // // // //
if node has a parent, removes node from parent and returns a reference to the removed child.
To prevent IE memory leak, call destroyNode on the returned node when it is no longer needed. // node: //
the node to remove from its parent. 删除指定的节点 Usage Example:
dojo.dom.removeNode(node); dojo.dom.getAncestors
function(/*Node*/node, /*function?*/filterFunction, /*boolean?*/returnFirstHit)