共用方式為


Sys.Application.getComponents Method

Returns an array of all components that have been registered with the application by using the addComponent method. This member is static and can be invoked without creating an instance of the class.

var componentArray = Sys.Application.getComponents();

Return Value

An array that contains all components that have been registered with the application by using the addComponent method.

Remarks

Use the getComponents function to retrieve an array of all components that have been registered with the client application by using the addComponent method.

Example

The following example retrieves registered components and writes their ID and type information to a <div> element.

function listComponents() {
    var c = Sys.Application.getComponents();
    var s = "";
    for (var i=0; i<c.length; i++) {
        var id = c[i].get_id();
        var type = Object.getType(c[i]).getName();
        s += 'Item ' + i + ': id=' + id + ', type=' + type + '.<br />';
    }
    div1.innerHTML = s;
}

See Also

Reference

Sys.Application Class

Other Resources

Language Reference