共用方式為


Sys.UI.Control toggleCssClass Method

Toggles a CSS class of the HTML Document Object Model (DOM) element that the control is attached to.

var a = new Sys.UI.MyControl(domElementObj);
a.toggleCssClass(className);

Parameters

Term

Definition

className

A string that contains the name of the CSS class to toggle.

Return Value

None.

Remarks

Use the toggleCssClass method to remove the CSS class from a control if the element contains the CSS class. If the element does not contain the CSS class, the toggleCssClass method adds the CSS class.

See Also

Reference

Sys.UI.Control Class

Other Resources

Language Reference