{infiniteZest}
// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
AJAX
Apple
ASP.NET
.NET
Git
Google / Android
Python / IronPython
Miscellaneous
SQL Server
AJAX Source Viewer
View the source code of a Method from ASP.NET AJAX Library. Choose a method from the menu items above (Namespaces, Classes, or Methods).
Method 'getElementById(id, element)'
Method: getElementById(id, element)
Method Full Name:     Sys$UI$DomElement$getElementById(id, element)
Class: DomElement
Namespace: Sys.UI
Source File: MicrosoftAjax.debug.js
1   var $get = Sys.UI.DomElement.getElementById = function Sys$UI$DomElement$getElementById(id, element) {
2     /// <summary locid="M:J#Sys.UI.DomElement.getElementById" />
3     /// <param name="id" type="String"></param>
4     /// <param name="element" domElement="true" optional="true" mayBeNull="true"></param>
5     /// <returns domElement="true" mayBeNull="true"></returns>
6     var e = Function._validateParams(arguments, [
7     {name: "id", type: String},
8     {name: "element", mayBeNull: true, domElement: true, optional: true}
9     ]);
10    if (e) throw e;
11    if (!element) return document.getElementById(id);
12    if (element.getElementById) return element.getElementById(id);
13    var nodeQueue = [];
14    var childNodes = element.childNodes;
15    for (var i = 0; i < childNodes.length; i++) {
16      var node = childNodes[i];
17      if (node.nodeType == 1) {
18        nodeQueue[nodeQueue.length] = node;
19      }
20    }
21    while (nodeQueue.length) {
22      node = nodeQueue.shift();
23      if (node.id == id) {
24        return node;
25      }
26      childNodes = node.childNodes;
27      for (i = 0; i < childNodes.length; i++) {
28        node = childNodes[i];
29        if (node.nodeType == 1) {
30          nodeQueue[nodeQueue.length] = node;
31        }
32      }
33    }
34    return null;
35  }
This is the JavaScript source for method getElementById(id, element) from ASP.NET AJAX Library. Full name for this method is Sys$UI$DomElement$getElementById(id, element). It belongs to the class DomElement, which is in Sys.UI namespace. This source is in MicrosoftAjax.debug.js file.
Bookmark and Share This
About  Contact  Privacy Policy  Site Map