STRONG 元素 | strong 對(duì)象
STYLE 元素 | style 對(duì)象
DHTML 對(duì)象
代表了給定元素所有可能的內(nèi)嵌樣式的當(dāng)前設(shè)置。
成員表
屬性 描述 onOffBehavior 獲取表明指定的 Microsoft® DirectAnimation® 行為是否正在運(yùn)行的對(duì)象。
濾鏡屬性 描述 Alpha 調(diào)整對(duì)象內(nèi)容的不透明度。 BlendTrans 以漸隱原始內(nèi)容的形式顯示對(duì)象的新內(nèi)容。 Chroma 將對(duì)象內(nèi)容的指定顏色顯示為透明。 DropShadow 創(chuàng)建對(duì)象內(nèi)容的實(shí)體陰影,偏移量位于指定方向。這將使得內(nèi)容看起來(lái)是浮動(dòng)的因此會(huì)產(chǎn)生陰影。 FlipH 以沿水平方向翻轉(zhuǎn)的形式顯示對(duì)象內(nèi)容。 FlipV 以沿垂直方向翻轉(zhuǎn)的形式顯示對(duì)象內(nèi)容。 Glow 在對(duì)象邊緣外側(cè)添加光暈以便使其看起來(lái)像發(fā)光的樣子。 Gray 以灰度顯示對(duì)象內(nèi)容。 Invert 反轉(zhuǎn)對(duì)象內(nèi)容的色調(diào)、飽和度和亮度。 Light 在對(duì)象的內(nèi)容上創(chuàng)建燈光效果。 MaskFilter 將對(duì)象內(nèi)容的透明像素顯示為彩色遮罩,將非透明像素顯示為透明。 MotionBlur 以運(yùn)動(dòng)模糊的效果顯示對(duì)象內(nèi)容。 Redirect 目前還不支持。 RevealTrans 使用 24 種預(yù)先定義的切換效果顯現(xiàn)對(duì)象的新內(nèi)容。 Shadow 創(chuàng)建對(duì)象內(nèi)容的實(shí)體陰影,偏移量位于指定方向。這將創(chuàng)建陰影效果。 Wave 在對(duì)象的內(nèi)容上執(zhí)行垂直方向的正弦波扭曲。 Xray 更改對(duì)象內(nèi)容的顏色深度將其以黑白顯示。
方法 描述 getAttribute 獲取指定標(biāo)簽屬性的值。 getAttributeNode 獲取由 attribute.name 屬性引用的 attribute 對(duì)象。 getExpression 獲取給定屬性的表達(dá)式。 normalize 合并鄰接 TextNode 對(duì)象以便生成一個(gè)常規(guī)的文檔對(duì)象模型。 removeAttribute 刪除對(duì)象的給定標(biāo)簽屬性。 removeAttributeNode 從對(duì)象中刪除刪除 attribute 對(duì)象。 removeExpression 從指定屬性中刪除表達(dá)式。 setAttribute 設(shè)置指定標(biāo)簽屬性的值。 setAttributeNode 設(shè)置 attribute 對(duì)象為對(duì)象的一部分。 setExpression 設(shè)置指定對(duì)象的表達(dá)式。
樣式標(biāo)簽屬性 樣式屬性 描述 ACCELERATOR accelerator 設(shè)置或獲取表明對(duì)象是否包含快捷鍵的字符串。 background background 設(shè)置或獲取對(duì)象最多五個(gè)獨(dú)立的背景屬性。 background-attachment backgroundAttachment 設(shè)置或獲取背景圖像如何附加到文檔內(nèi)的對(duì)象中。 background-color backgroundColor 設(shè)置或獲取對(duì)象內(nèi)容后的顏色。 background-image backgroundImage 設(shè)置或獲取對(duì)象的背景圖像。 background-position backgroundPosition 設(shè)置或獲取對(duì)象背景的位置。 background-position-x backgroundPositionX 設(shè)置或獲取 backgroundPosition 屬性的 x 坐標(biāo)。 background-position-y backgroundPositionY 設(shè)置或獲取 backgroundPosition 屬性的 y 坐標(biāo)。 background-repeat backgroundRepeat 設(shè)置或獲取對(duì)象的 backgroundImage 屬性如何平鋪。 behavior behavior 設(shè)置或獲取 DHTML 行為的位置。 border border 設(shè)置或獲取對(duì)象周圍邊框的繪制屬性。 border-bottom borderBottom 設(shè)置或獲取對(duì)象下邊框的屬性。 border-bottom-color borderBottomColor 設(shè)置或獲取對(duì)象下邊框的顏色。 border-bottom-style borderBottomStyle 設(shè)置或獲取對(duì)象下邊框的樣式。 border-bottom-width borderBottomWidth 設(shè)置或獲取對(duì)象下邊框的寬度。 border-collapse borderCollapse 設(shè)置或獲取表明表格行和單元格邊框是組合為單一邊框還是像標(biāo)準(zhǔn) HTML 那樣分離。 border-color borderColor 設(shè)置或獲取對(duì)象的邊框顏色。 border-left borderLeft 設(shè)置或獲取對(duì)象左邊框的屬性。 border-left-color borderLeftColor 設(shè)置或獲取對(duì)象左邊框的顏色。 border-left-style borderLeftStyle 設(shè)置或獲取對(duì)象左邊框的樣式。 border-left-width borderLeftWidth 設(shè)置或獲取對(duì)象左邊框的寬度。 border-right borderRight 設(shè)置或獲取對(duì)象右邊框的屬性。 border-right-color borderRightColor 設(shè)置或獲取對(duì)象右邊框的顏色。 border-right-style borderRightStyle 設(shè)置或獲取對(duì)象右邊框的樣式。 border-right-width borderRightWidth 設(shè)置或獲取對(duì)象右邊框的寬度。 border-style borderStyle 設(shè)置或獲取對(duì)象上下左右邊框的樣式。 border-top borderTop 設(shè)置或獲取對(duì)象上邊框的屬性。 border-top-color borderTopColor 設(shè)置或獲取對(duì)象上邊框的顏色。 border-top-style borderTopStyle 設(shè)置或獲取對(duì)象上邊框的樣式。 border-top-width borderTopWidth 設(shè)置或獲取對(duì)象上邊框的寬度。 border-width borderWidth 設(shè)置或獲取對(duì)象上下左右邊框的寬度。 bottom bottom 設(shè)置或獲取對(duì)象相對(duì)于文檔層次中下個(gè)定位對(duì)象的底部的位置。 clear clear 設(shè)置或獲取對(duì)象是否允許在其左側(cè)、右側(cè)或兩邊放置浮動(dòng)對(duì)象,以防下段文本顯示在浮動(dòng)對(duì)象上。 clip clip 設(shè)置或獲取定位對(duì)象的哪個(gè)部分可見(jiàn)。 color color 設(shè)置或獲取對(duì)象文本的顏色。 cssText 設(shè)置或獲取樣式規(guī)則的永久表述。 cursor cursor 設(shè)置或獲取當(dāng)鼠標(biāo)指針指向對(duì)象時(shí)所使用的鼠標(biāo)指針。 direction direction 設(shè)置或獲取對(duì)象的閱讀順序。 display display 設(shè)置或獲取對(duì)象是否要渲染。 font font 設(shè)置或獲取對(duì)象最多六個(gè)獨(dú)立的字體屬性。 font-family fontFamily 設(shè)置或獲取對(duì)象文本所使用的字體名稱。 font-size fontSize 設(shè)置或獲取對(duì)象文本使用的字體大小。 font-style fontStyle 設(shè)置或獲取對(duì)象的字體樣式,如斜體、常規(guī)或傾斜。 font-variant fontVariant 設(shè)置或獲取對(duì)象文本是否以小型大寫(xiě)字母顯示。 font-weight fontWeight 設(shè)置或獲取對(duì)象的字體寬度。 height height 設(shè)置或獲取對(duì)象的高度。 ime-mode imeMode 獲取輸入方法編輯器(IME)的狀態(tài)。 layout-flow layoutFlow 設(shè)置或獲取對(duì)象內(nèi)容的方向和繞排方向。 layout-grid layoutGrid 設(shè)置或獲取指定文本字符版面的組合文檔格線屬性。 layout-grid-char layoutGridChar 設(shè)置或獲取用于渲染元素文本內(nèi)容的字符網(wǎng)格大小。 layout-grid-line layoutGridLine 設(shè)置或獲取用于渲染元素文本內(nèi)容的網(wǎng)格線值。 layout-grid-mode layoutGridMode 設(shè)置或獲取文本布局網(wǎng)格是否使用二維。 layout-grid-type layoutGridType 設(shè)置或獲取用于渲染元素文本內(nèi)容的網(wǎng)格類型。 left left 設(shè)置或獲取對(duì)象相對(duì)于文檔層次中下個(gè)定位對(duì)象的左邊界的位置。 letter-spacing letterSpacing 設(shè)置或獲取對(duì)象的字符間附加空間的總和。 line-break lineBreak 設(shè)置或獲取日本文本的換行規(guī)則。 line-height lineHeight 設(shè)置或獲取對(duì)象兩行間的距離。 list-style listStyle 設(shè)置或獲取對(duì)象最多三個(gè)獨(dú)立的 listStyle 屬性。 list-style-image listStyleImage 獲取要為對(duì)象應(yīng)用的列表項(xiàng)目符號(hào)的圖像。 list-style-position listStylePosition 獲取相對(duì)于對(duì)象內(nèi)容如何繪制項(xiàng)目符號(hào)。 list-style-type listStyleType 獲取對(duì)象預(yù)定義的項(xiàng)目符號(hào)類型。 margin margin 設(shè)置或獲取對(duì)象的上下左右邊距。 margin-bottom marginBottom 設(shè)置或獲取對(duì)象的下邊距寬度。 margin-left marginLeft 設(shè)置或獲取對(duì)象的左邊距寬度。 margin-right marginRight 設(shè)置或獲取對(duì)象的右邊距寬度。 margin-top marginTop 設(shè)置或獲取對(duì)象的上邊距寬度。 min-height minHeight 設(shè)置或獲取元素的最小高度。 overflow overflow 設(shè)置或獲取表明當(dāng)內(nèi)容超出對(duì)象高度或?qū)挾葧r(shí)如何管理對(duì)象內(nèi)容的值。 overflow-x overflowX 設(shè)置或獲取當(dāng)內(nèi)容超出對(duì)象寬度時(shí)如何管理對(duì)象內(nèi)容。 overflow-y overflowY 設(shè)置或獲取當(dāng)內(nèi)容超出對(duì)象高度時(shí)如何管理對(duì)象內(nèi)容。 padding padding 設(shè)置或獲取要在對(duì)象和其邊距或若存在的邊框的話就是對(duì)象和其邊框之間要插入的全部空間。 padding-bottom paddingBottom 設(shè)置或獲取要在對(duì)象下邊框和內(nèi)容之間插入的空間總量。 padding-left paddingLeft 設(shè)置或獲取要在對(duì)象左邊框和內(nèi)容之間插入的空間總量。 padding-right paddingRight 設(shè)置或獲取要在對(duì)象右邊框和內(nèi)容之間插入的空間總量。 padding-top paddingTop 設(shè)置或獲取對(duì)象上邊框和內(nèi)容之間插入的空間總量。 page-break-after pageBreakAfter 設(shè)置或獲取表明對(duì)象后發(fā)生換頁(yè)的字符串。 page-break-before pageBreakBefore 設(shè)置或獲取表明對(duì)象前發(fā)生換頁(yè)的字符串。 pixelBottom 設(shè)置或獲取對(duì)象的下方位置。 pixelHeight 設(shè)置或獲取對(duì)象的高度。 pixelLeft 設(shè)置或獲取對(duì)象的左側(cè)位置。 pixelRight 設(shè)置或獲取對(duì)象的右側(cè)位置。 pixelTop 設(shè)置或獲取對(duì)象的上方位置。 pixelWidth 設(shè)置或獲取對(duì)象的寬度。 posBottom 設(shè)置或獲取以 bottom 標(biāo)簽屬性指定的單位的對(duì)象下方位置。 posHeight 設(shè)置或獲取以 height 標(biāo)簽屬性指定的單位的對(duì)象高度。 position position 設(shè)置或獲取對(duì)象所使用的定位方式。 posLeft 設(shè)置或獲取以 left 標(biāo)簽屬性指定的單位的對(duì)象左側(cè)位置。 posRight 設(shè)置或獲取以 right 標(biāo)簽屬性指定的單位的對(duì)象右側(cè)位置。 posTop 設(shè)置或獲取以 top 標(biāo)簽屬性指定的單位的對(duì)象上方位置。 posWidth 設(shè)置或獲取以 width 標(biāo)簽屬性指定的單位的對(duì)象寬度。 right right 設(shè)置或獲取對(duì)象相對(duì)于文檔層次中下個(gè)已定位的對(duì)象的右邊界的位置。 ruby-align rubyAlign 獲取由 RT 對(duì)象指定的注音文本的位置。 ruby-overhang rubyOverhang 獲取由 RT 對(duì)象指定的注音文本的位置。 ruby-position rubyPosition 獲取由 RT 對(duì)象指定的注音文本的位置。 scrollbar-3dlight-color scrollbar3dLightColor 設(shè)置或獲取滾動(dòng)條上滾動(dòng)按鈕和滾動(dòng)滑塊的左上顏色。 scrollbar-arrow-color scrollbarArrowColor 設(shè)置或獲取滾動(dòng)箭頭標(biāo)識(shí)的顏色。 scrollbar-base-color scrollbarBaseColor 設(shè)置或獲取滾動(dòng)條的主要顏色,其中包含滾動(dòng)按鈕和滾動(dòng)滑塊。 scrollbar-darkshadow-color scrollbarDarkShadowColor 設(shè)置或獲取滾動(dòng)條上滑槽的顏色。 scrollbar-face-color scrollbarFaceColor 設(shè)置或獲取滾動(dòng)條和滾動(dòng)條的滾動(dòng)箭頭的顏色。 scrollbar-highlight-color scrollbarHighlightColor 設(shè)置或獲取滾動(dòng)框和滾動(dòng)條滾動(dòng)箭頭的左上邊緣顏色。 scrollbar-shadow-color scrollbarShadowColor 設(shè)置或獲取滾動(dòng)框和滾動(dòng)條滾動(dòng)箭頭的右下邊緣顏色。 scrollbar-track-color scrollbarTrackColor 設(shè)置或獲取滾動(dòng)條軌跡元素的顏色。 float styleFloat 設(shè)置或獲取文本要繞排到對(duì)象的哪一側(cè)。 table-layout tableLayout 獲取表明表格布局是否固定的字符串。 text-align textAlign 設(shè)置或獲取對(duì)象中的文本是左對(duì)齊、右對(duì)齊、居中對(duì)齊還是兩端對(duì)齊。 text-align-last textAlignLast 設(shè)置或獲取如何排列對(duì)象的最后一行或僅有的一行。 text-autospace textAutospace 設(shè)置或獲取自動(dòng)留空和文本的窄空間寬度調(diào)整。 text-decoration textDecoration 設(shè)置或獲取對(duì)象中的文本是否有閃爍、刪除線、上劃線或下劃線的樣式。 textDecorationBlink 設(shè)置或獲取表明對(duì)象的 textDecoration 屬性是否含有有“blink”的 Boolean 值。 textDecorationLineThrough 設(shè)置或獲取表明對(duì)象內(nèi)的文本是否有刪除線的 Boolean 值。 textDecorationNone 設(shè)置或獲取表明對(duì)象的 textDecoration 屬性是否設(shè)置為 none 的 Boolean 值。 textDecorationOverline 設(shè)置或獲取表明對(duì)象中的文本是否有上劃線的 Boolean 值。 textDecorationUnderline 設(shè)置或獲取對(duì)象中的文本是否有下劃線的 Boolean 值。 text-indent textIndent 設(shè)置或獲取對(duì)象中文本的縮進(jìn)。 text-justify textJustify 設(shè)置或獲取對(duì)象內(nèi)的文本所使用的對(duì)齊類型。 text-kashida-space textKashidaSpace 設(shè)置或獲取對(duì)象內(nèi)文本對(duì)齊行時(shí)所使用空白擴(kuò)展的 kashida 擴(kuò)展的倍率。 text-overflow textOverflow 設(shè)置或獲取表明是否顯示省略號(hào)以表明文本溢出的值。 text-transform textTransform 設(shè)置或獲取對(duì)象中文本的渲染方式。 text-underline-position textUnderlinePosition 設(shè)置或獲取對(duì)象的 textDecoration 屬性中設(shè)置的下劃線的位置。 top top 設(shè)置或獲取對(duì)象相對(duì)于文檔層次中下個(gè)定位對(duì)象的上邊界的位置。 unicode-bidi unicodeBidi 設(shè)置或獲取關(guān)于雙向法則的嵌入級(jí)別。 vertical-align verticalAlign 設(shè)置或獲取對(duì)象的垂直排列。 visibility visibility 設(shè)置或獲取對(duì)象的內(nèi)容是否顯示。 white-space whiteSpace 設(shè)置或獲取對(duì)象中是否自動(dòng)換行。 width width 設(shè)置或獲取對(duì)象的寬度。 word-break wordBreak 設(shè)置或獲取單詞內(nèi)的換行行為,特別是對(duì)象中出現(xiàn)多語(yǔ)言的情況。 word-spacing wordSpacing 設(shè)置或獲取對(duì)象中單詞間的附加空間總量。 word-wrap wordWrap 設(shè)置或獲取當(dāng)內(nèi)容超過(guò)其容器邊界時(shí)是否斷詞。 writing-mode writingMode 設(shè)置或獲取對(duì)象內(nèi)容的方向和繞排。 z-index zIndex 設(shè)置或獲取定位對(duì)象的堆疊次序。 zoom zoom 設(shè)置或獲取對(duì)象的放大比例。
注釋
所謂內(nèi)嵌樣式,是指你使用 STYLE 標(biāo)簽屬性直接為單個(gè) HTML 元素應(yīng)用的樣式表(CSS)指派。使用 style 對(duì)象可以檢查這些指派,并進(jìn)行新的指派或更改已有的。
要使用 style 對(duì)象,應(yīng)該在元素對(duì)象上使用 style 關(guān)鍵字。要獲得內(nèi)嵌樣式的當(dāng)前設(shè)置,應(yīng)該在 style 上使用對(duì)應(yīng)的 style 屬性。
style 對(duì)象并不提供對(duì)定義在樣式表中的樣式指派的訪問(wèn)。要獲得樣式表中樣式的信息,請(qǐng)使用 styleSheets 集合訪問(wèn)定義于文檔中的單個(gè)樣式表。
當(dāng) rule 對(duì)象訪問(wèn) style 對(duì)象時(shí),下列屬性不可用: posHeight, posWidth, posTop, posLeft, pixelHeight, pixelWidth, pixelTop 和 pixelLeft。
此對(duì)象在 Microsoft® Internet Explorer 4.0 的腳本中可用。
示例
下面的例子使用 style 對(duì)象將文檔主體文本的字體設(shè)置為 Verdana。
document.body.style.fontFamily = "Verdana"這個(gè)例子將給定文檔中的全部絕對(duì)定位的圖像都放置在文檔頂部。
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; } } }這個(gè)例子將第二個(gè)元素(div2)的內(nèi)嵌樣式復(fù)制到了第一個(gè)元素(div1)中,同時(shí)還保留第二個(gè)的樣式。div1 的背景顏色將在指派的過(guò)程中被覆蓋。
<DIV ID="div1" STYLE="background-color:blue;font-weight:bold">項(xiàng)目 1</DIV> <DIV ID="div2" STYLE="background-color:red;font-size:18pt; font-family:Verdana;">項(xiàng)目 2</DIV> <SCRIPT> div1.style.cssText += (';' + div2.style.cssText); </SCRIPT>
標(biāo)準(zhǔn)信息
沒(méi)有應(yīng)用于此對(duì)象的公共標(biāo)準(zhǔn)。
應(yīng)用到
A, ACRONYM, ADDRESS, APPLET, B, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, CUSTOM, DD, defaults, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, NOBR, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, rule, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP