Condividi tramite


Sys.UI.DomElement getVisible Method

Gets a value that indicates whether a DOM element is currently visible on the Web page. This member is static and can be invoked without creating an instance of the class.

var v = Sys.UI.DomElement.getVisible(element);

Parameters

Term

Definition

element

The target DOM element.

Returns

true if element is visible on the Web page; otherwise, false

Remarks

Use the getVisible method to determine whether a DOM element is currently visible on the Web page. Calling the getVisible method differs from reading the DOM element's visibility property directly because the getVisible method accounts for visibility modes applied with the Sys.UI.DomElement.setVisibilityMode method.

For information about how to set the layout characteristics of hidden DOM elements, see Sys.UI.DomElement setVisibilityMode Method.

Example

The following example shows how to use the getVisible method. The code toggles the visibility of an element based on its current setting.

var anElement = $get("Label1");
if (Sys.UI.DomElement.getVisible(anElement)){
    Sys.UI.DomElement.setVisible(anElement, false);
}
else{
    Sys.UI.DomElement.setVisible(anElement, true);
}

See Also

Reference

Sys.UI.DomElement Class

Other Resources

Language Reference