How does this js know $ get is function (id) {return document.getElementById (id); }

So, I was looking at a blog post with some javascript in it and there is something I am looking at that doesn't quite follow:

function pageLoadedHandler(sender, args) {  
    if (typeof(lastFocusedControlId) !== "undefined" 
         && lastFocusedControlId != "")   
    {  
        var newFocused = $get(lastFocusedControlId);  
        if (newFocused) {    
            focusControl(newFocused);
        }
    }

      

In the above method, it calls $ get which I am assuming to be an alias

 function(id) { 
     return document.getElementById(id); 
 }

      

The supplied js file does not contain the $ get argument.

This is a reserved alias and someone might provide a link that confirms this. If not, how does he know what $ get is?

0


a source to share


3 answers


Yes, I found them: Quoting Msdn

Sys.UI.DomElement $ get Method

Provides a shortcut to the getElementById method of the Sys.UI.DomElement class. This member is static and can be called without instantiating the class.



http://www.asp.net/AJAX/Documentation/Live/ClientReference/Global/GetShortCutMethod.aspx

http://msdn.microsoft.com/en-us/library/bb397717.aspx

Very hard to find $ get

0


a source


I believe you are looking at ASP.NET AJAX keyboard shortcuts.



http://mattberseth.com/blog/2007/08/the_everuseful_get_and_find_as.html

+3


a source


The example you mentioned is based on ASP.NET, $ find and $ get are two "shortcut" functions provided by the MS Ajax Framework

+1


a source







All Articles