javascript 查msdn方法

style Object


Represents the current settings of all possible inline styles for a given element.

Members Table

The following table lists the members exposed by the style object. Click a tab on the left to choose the type of member you want to view.

 
Styles
 
Show:
Attributes/Properties
Filters
Methods
Styles
Style attributeStyle propertyDescription
<?XML:NAMESPACE PREFIX = MSHelp NS = "http://msdn.microsoft.com/mshelp" />Sets or retrieves a string that indicates whether the object contains an accelerator key.
Sets or retrieves up to five separate background properties of the object.
Sets or retrieves how the background image is attached to the object within the document.
Sets or retrieves the color behind the content of the object.
Sets or retrieves the background image of the object.
Sets or retrieves the position of the background of the object.
Sets or retrieves the x-coordinate of the property.
Sets or retrieves the y-coordinate of the backgroundPosition property.
Sets or retrieves how the property of the object is tiled.
Sets or retrieves the location of the .
Sets or retrieves the properties to draw around the object.
Sets or retrieves the properties of the bottom border of the object.
Sets or retrieves the color of the bottom border of the object.
Sets or retrieves the style of the bottom border of the object.
Sets or retrieves the width of the bottom border of the object.
Sets or retrieves a value that indicates whether the row and cell borders of a table are joined in a single border or detached as in standard HTML.
Sets or retrieves the border color of the object.
Sets or retrieves the properties of the left border of the object.
Sets or retrieves the color of the left border of the object.
Sets or retrieves the style of the left border of the object.
Sets or retrieves the width of the left border of the object.
Sets or retrieves the properties of the right border of the object.
Sets or retrieves the color of the right border of the object.
Sets or retrieves the style of the right border of the object.
Sets or retrieves the width of the right border of the object.
Sets or retrieves the style of the left, right, top, and bottom borders of the object.
Sets or retrieves the properties of the top border of the object.
Sets or retrieves the color of the top border of the object.
Sets or retrieves the style of the top border of the object.
Sets or retrieves the width of the top border of the object.
Sets or retrieves the width of the left, right, top, and bottom borders of the object.
Sets or retrieves the bottom position of the object in relation to the bottom of the next positioned object in the document hierarchy.
Sets or retrieves whether the object allows floating objects on its left side, right side, or both, so that the next text displays past the floating objects.
Sets or retrieves which part of a positioned object is visible.
Sets or retrieves the color of the text of the object.
Sets or retrieves the persisted representation of the style rule.
Sets or retrieves the type of cursor to display as the mouse pointer moves over the object.
Sets or retrieves the reading order of the object.
Sets or retrieves whether the object is rendered.
Sets or retrieves a combination of separate properties of the object. Alternatively, sets or retrieves one or more of six user-preference fonts.
Sets or retrieves the name of the font used for text in the object.
Sets or retrieves a value that indicates the font size used for text in the object.
Sets or retrieves the font style of the object as italic, normal, or oblique.
Sets or retrieves whether the text of the object is in small capital letters.
Sets or retrieves the weight of the font of the object.
Sets or retrieves the height of the object.
Sets or retrieves the state of an Input Method Editor (IME).
Sets or retrieves the direction and flow of the content in the object.
Sets or retrieves the composite document grid properties that specify the layout of text characters.
Sets or retrieves the size of the character grid used for rendering the text content of an element.
Sets or retrieves the gridline value used for rendering the text content of an element.
Sets or retrieves whether the text layout grid uses two dimensions.
Sets or retrieves the type of grid used for rendering the text content of an element.
Sets or retrieves the position of the object relative to the left edge of the next positioned object in the document hierarchy.
Sets or retrieves the amount of additional space between letters in the object.
Sets or retrieves line-breaking rules for Japanese text.
Sets or retrieves the distance between lines in the object.
Sets or retrieves up to three separate properties of the object.
Sets or retrieves a value that indicates which image to use as a list-item marker for the object.
Sets or retrieves a variable that indicates how the list-item marker is drawn relative to the content of the object.
Sets or retrieves the predefined type of the line-item marker for the object.
Sets or retrieves the width of the top, right, bottom, and left margins of the object.
Sets or retrieves the height of the bottom margin of the object.
Sets or retrieves the width of the left margin of the object.
Sets or retrieves the width of the right margin of the object.
Sets or retrieves the height of the top margin of the object.
  Sets or retrieves the minimum height for an element.
Sets or retrieves a value indicating how to manage the content of the object when the content exceeds the height or width of the object.
Sets or retrieves how to manage the content of the object when the content exceeds the width of the object.
Sets or retrieves how to manage the content of the object when the content exceeds the height of the object.
Sets or retrieves the amount of space to insert between the object and its margin or, if there is a border, between the object and its border.
Sets or retrieves the amount of space to insert between the bottom border of the object and the content.
Sets or retrieves the amount of space to insert between the left border of the object and the content.
Sets or retrieves the amount of space to insert between the right border of the object and the content.
Sets or retrieves the amount of space to insert between the top border of the object and the content.
Sets or retrieves a value indicating whether a page break occurs after the object.
Sets or retrieves a string indicating whether a page break occurs before the object.
Sets or retrieves the bottom position of the object.
Sets or retrieves the height of the object.
Sets or retrieves the left position of the object.
Sets or retrieves the right position of the object.
Sets or retrieves the top position of the object.
Sets or retrieves the width of the object.
Sets or retrieves the bottom position of the object in the units specified by the attribute.
Sets or retrieves the height of the object in the units specified by the attribute.
Sets or retrieves the type of positioning used for the object.
Sets or retrieves the left position of the object in the units specified by the attribute.
Sets or retrieves the right position of the object in the units specified by the attribute.
Sets or retrieves the top position of the object in the units specified by the attribute.
Sets or retrieves the width of the object in the units specified by the attribute.
Sets or retrieves the position of the object relative to the right edge of the next positioned object in the document hierarchy.
Sets or retrieves the position of the ruby text specified by the object.
Sets or retrieves the position of the ruby text specified by the rt object.
Sets or retrieves the position of the ruby text specified by the rt object.
Sets or retrieves the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.
Sets or retrieves the color of the arrow elements of a scroll arrow.
Sets or retrieves the color of the main elements of a scroll bar, which include the scroll box, track, and scroll arrows.
Sets or retrieves the color of the gutter of a scroll bar.
Sets or retrieves the color of the scroll box and scroll arrows of a scroll bar.
Sets or retrieves the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.
Sets or retrieves the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar.
Sets or retrieves the color of the track element of a scroll bar.
Sets or retrieves on which side of the object the text will flow.
Sets or retrieves a string that indicates whether the table layout is fixed.
Sets or retrieves whether the text in the object is left-aligned, right-aligned, centered, or justified.
Sets or retrieves how to align the last line or only line of text in the object.
Sets or retrieves the autospacing and narrow space width adjustment of text.
Sets or retrieves a value that indicates whether the text in the object has blink, line-through, overline, or underline decorations.
Sets or retrieves a Boolean value that indicates whether the object's property has a value of "blink."
Sets or retrieves a Boolean value indicating whether the text in the object has a line drawn through it.
Sets or retrieves the Boolean value indicating whether the textDecoration property for the object has been set to none.
Sets or retrieves a Boolean value indicating whether the text in the object has a line drawn over it.
Sets or retrieves whether the text in the object is underlined.
Sets or retrieves the indentation of the first line of text in the object.
Sets or retrieves the type of alignment used to justify text in the object.
Sets or retrieves the ratio of kashida expansion to white space expansion when justifying lines of text in the object.
  Sets or retrieves a value that indicates whether to render ellipses(...) to indicate text overflow.
Sets or retrieves the rendering of the text in the object.
Sets or retrieves the position of the underline decoration that is set through the property of the object.
Sets or retrieves the position of the object relative to the top of the next positioned object in the document hierarchy.
Sets or retrieves the level of embedding with respect to the bidirectional algorithm.
Sets or retrieves the vertical alignment of the object.
Sets or retrieves whether the content of the object is displayed.
Sets or retrieves a value that indicates whether lines are automatically broken inside the object.
Sets or retrieves the width of the object.
Sets or retrieves line-breaking behavior within words, particularly where multiple languages appear in the object.
Sets or retrieves the amount of additional space between words in the object.
Sets or retrieves whether to break words when the content exceeds the boundaries of its container.
Sets or retrieves the direction and flow of the content in the object.
Sets or retrieves the stacking order of positioned objects.
Sets or retrieves the magnification scale of the object.

Attributes/Properties

PropertyDescription
Retrieves an object indicating whether the specified Microsoft® DirectAnimation® behavior is running.

Filters

Filter propertyDescription
Adjusts the opacity of the content of the object.
Reveals new content of the object by fading the original content.
Displays a specific color of the content of the object as transparent.
Creates a solid silhouette of the content of the object, offset in the specified direction. This creates the illusion that the content is floating and casting a shadow.
Displays the content of the object flipped across the horizontal axis.
Displays the content of the object flipped across the vertical axis.
Adds radiance around the outside edges of the content of the object so that it appears to glow.
Displays the content of the object in grayscale.
Reverses the hue, saturation, and brightness values of the content of the object.
Creates the effect of a light shining on the content of the object.
Displays transparent pixels of the object content as a color mask, and makes the nontransparent pixels transparent.
Causes the content of the object to appear to be in motion.
Not currently supported.
Reveals new content of the object using one of 24 predefined effects.
Creates a solid silhouette of the content of the object, offset in the specified direction. This creates the illusion of a shadow.
Performs a sine wave distortion of the content of the object along the vertical axis.
Changes the color depth of the content of the object and displays it in black and white.

Methods

MethodDescription
Retrieves the value of the specified attribute.
  Retrieves an object referenced by the attribute. property.
Retrieves the expression for the given property.
  Merges adjacent objects to produce a normalized document object model.
Removes the given attribute from the object.
  Removes an attribute object from the object.
Removes the expression from the specified property.
Sets the value of the specified attribute.
  Sets an attribute object node as part of the object.
Sets an expression for the specified object.

Styles

Remarks

Inline styles are Cascading Style Sheets (CSS) assignments that you apply directly to individual HTML elements using the attribute. Use the style object to examine these assignments and to make new assignments or change existing ones.

To retrieve the style object, apply the style keyword to an element object. To retrieve the current setting for an inline style, apply the corresponding style property to the style object.

The style object does not provide access to the style assignments in style sheets. To obtain information about styles in style sheets, use the collection to access to the individual style sheets defined in the document.

The following properties are not available when the object accesses the style object: , , , , , , , and .

To change or clear multiple style properties at once, use this object with the property. For example, to change the font color and background color of a element, you could use the following code:

<DIV οnclick="this.style.cssText = 'color:red;background-color:blue;border:5px solid black;'">
Click on this DIV to change style properties.</DIV>

This object is available in script in Internet Explorer 4.0.

Examples

This example uses the style object to set the document body text font to Verdana.

document.body.style.fontFamily = "Verdana"

This example positions all absolutely positioned images in the given document at the top of the document.

var oImages = document.all.tags("IMG");
if (oImages.length) {
    for (var iImg = 0; iImg < oImages.length; iImg++) {
        var oImg = oImages(iImg);
        if (oImg.style.position == "absolute") {
            oImg.style.top = 0;
        }
    }
}

This example copies the inline style of the second element (div2) to the first (div1) while preserving the styles of the second. The background color of div1 is overwritten during the assignment.

<DIV ID="div1" STYLE="background-color:blue;font-weight:bold">Item 1</DIV>
<DIV ID="div2" STYLE="background-color:red;font-size:18pt;
    font-family:Verdana;">Item 2</DIV>

<SCRIPT>
div1.style.cssText += (';' + div2.style.cssText);
</SCRIPT>

Standards Information

There is no public standard that applies to this object.

注: Style attribute 是html直接写在控件旁边的属性或者方法
            Style property 是javascript可以取到的控件的属性或方法

转载于:https://www.cnblogs.com/Dtor/archive/2006/03/02/341085.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值