You are here: Reference > JavaScript > client-side > style handling > properties > textDecorationLineThrough
textDecorationLineThrough property
Sets or returns a Boolean value that indicates whether the text is displayed with a line in the middle.
To set the decoration of text, use the textDecoration style property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
Possible values:
Boolean that indicates the state of text through-lining.
One of the following values:
Text is not line-through. | |||||||
Text is line-through. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the textDecorationLineThrough property:
|
||||
<head> <script type="text/javascript"> function ChangeDecor (propIdx){ var div = document.getElementById ("myDiv"); if (propIdx < 5 && div.style.textDecorationNone) { div.style.textDecorationNone = false; document.getElementsByTagName ("INPUT")[4].checked = false; } switch (propIdx){ case 1: div.style.textDecorationBlink = !div.style.textDecorationBlink; break; case 2: div.style.textDecorationLineThrough = !div.style.textDecorationLineThrough; break; case 3: div.style.textDecorationOverline = !div.style.textDecorationOverline; break; case 4: div.style.textDecorationUnderline = !div.style.textDecorationUnderline; break; case 5: div.style.textDecorationNone = !div.style.textDecorationNone; if (div.style.textDecorationNone) { for (i = 0; i < 4; i++) { document.getElementsByTagName ("INPUT")[i].checked = false; } } break; } } </script> </head> <body> <div id="myDiv">Change the decoration of this text with the checkBoxes below.</div> <input type="checkbox" onclick="ChangeDecor (1);"/> textDecorationBlink <br /> <input type="checkbox" onclick="ChangeDecor (2);"/> textDecorationLineThrough <br /> <input type="checkbox" onclick="ChangeDecor (3);"/> textDecorationOverline : <br /> <input type="checkbox" onclick="ChangeDecor (4);"/> textDecorationUnderline : <br /> <input type="checkbox" onclick="ChangeDecor (5);"/> textDecorationNone </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
htmlElement.runtimeStyle, htmlElement.style
HTML elements:
a, abbr, acronym, address, b, bdo, big, blockquote, body, button, caption, center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, html, i, input:button, input:file, input:password, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, option, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments