dojo.byId and dijit.byId
来源:互联网 发布:c语言matlab混编 编辑:程序博客网 时间:2024/04/28 16:04
dojo.byId(String id)
This function is a synonym for document.all.id in IE or document.getElementById(id) in standard DOM. So you can say:
If document.getElementById() works in all modern browsers, why use this? Sadly, bugs persist in Internet Explorer which make getElementById() unstable in some common scenarios. Also, dojo.byId() is easier to type.
dijit.byId(String id)
Because of the almost-identical spelling, this method is commonly mixed up with dojo.byId(String id). Here's the difference: dijit.byId() returns a Dijit widget instance - technically, an instance of dijit._Widget or one of its subclasses like dijit.Toolbar or dijit.TreeNode.
So here's the way to remember it:
- If you need a DOM Node, use dojo.byId. You need a DOM node anytime you call a standard browser function, change a standard property, etc.
- If you need a widget, use dijit.byId. From it you can access all of the attributes, methods and extension points listed in Part 2.
Or for you who think in terms of functions (e.g. LISP programmers?):
var myDomNode = dojo.byId("foo");var myWidget = dijit.byId("foo");console.debug(myDomNode == myWidget.domNode); // trueconsole.debug(dijit.byNode(myDomNode) == myWidget); // true
- dojo.byId and dijit.byId
- dojo.byId and dijit.byId
- dojo.byId与registry.byId、dijit.byId
- data-dojo-id, dijit/registry.byId() and dojo/dom.byId()
- Dojo学习:dijit.byId与dojo.byId的区别
- dojo.byId() dijit.byId() & jsId的区别与联系
- dojo.byId() dijit.byId() & jsId的区别与联系
- dojo.byId
- byId
- dojo.byId viewDemo
- dijit.byId("grid") is undefined
- IdentifierLoadAccess and Session.byId()
- dojo 学习笔记之一 dom.byId dojo.byId registry.byId 的区别
- dojo041中dojo.byId存在问题
- 使用 dijit.byId 连接到一个按钮并添加事件
- 使用registry.byId来获取dgrid
- DOM(document获取节点byId.byName.byTagName)
- DOJO dijit.dialog
- 招聘注意事项
- sql自增号
- 如果让我重做一次研究生--王汎森
- 六月的校园
- 实验10 硬盘DMA编程
- dojo.byId and dijit.byId
- 自动生成Insert数据的SQL脚本
- 二叉树的创建
- 我
- 我
- 我
- [转]职场少走弯路的十条忠告
- 当代计算机专业学生
- 遍历二叉树